#include <bits/stdc++.h>
using namespace std;
int main() {
  string X;
  cin >> X;
  for (int i = 1; i < X.size(); i++) {
    if (X[i - 1] == 'S' && X[i] == 'T') {
      X.erase(X.begin() + i - 1);
      X.erase(X.begin() + i - 1);
      i -= 2;
    }
    cout << X << endl;
  }
  cout << X.size() << endl;
  return 0;
}
