#include <bits/stdc++.h>
int dx[] = {0, 0, -1, 1};
int dy[] = {1, -1, 0, 0};
using namespace std;
int main() {
  string s;
  cin >> s;
  int len = s.length();
  for (int i = 0; i < len - 1; ++i) {
    if (s[i] == 'S' && s[i + 1] == 'T') {
      s.erase(s.begin() + i);
      s.erase(s.begin() + i);
      cout << s << endl;
      len -= 2;
      i -= 2;
    }
  }
  cout << len << "\n";
  return 0;
}
