#include <bits/stdc++.h>
using namespace std;
template <class F, class T>
void convert(const F &f, T &t) {
  stringstream ss;
  ss << f;
  ss >> t;
}
long int pow(long int n, int m) {
  if (m <= 0) {
    return 1;
  } else {
    return n * pow(n, m - 1);
  }
}
int main() {
  string s;
  cin >> s;
  int Scount = 0;
  for (int i = 0; i < s.size(); ++i) {
    char c = s[i];
    if (c == 'S') {
      Scount++;
    } else if (c == 'T') {
      if (Scount > 0) {
        Scount--;
      } else {
        cout << c;
      }
    } else {
      cout << c;
      Scount = 0;
    }
  }
  for (int i = 0; i < Scount; ++i) {
    cout << 'S';
  }
  cout << endl;
  return 0;
}
