#include <bits/stdc++.h>
int main() {
  std::string inputString;
  std::cin >> inputString;
  std::cout << inputString << "\n";
  for (int i = 0; i < ((int)(inputString.size() - 1)); i++) {
    if (inputString[i] == 'S' && inputString[i + 1] == 'T') {
      inputString.erase(i, i + 1);
      i--;
    }
  }
  std::cout << inputString.size();
  return 0;
}
