#include <bits/stdc++.h>
using namespace std;
using ll = long long;
using vi = vector<int>;
int main() {
  ios::sync_with_stdio(false);
  cin.tie(0);
  string s;
  cin >> s;
  int n = 0;
  for (char c : s) {
    if (c == 'S')
      n++;
    else {
      if (n)
        n--;
      else {
        cout << string(n, 'S') << 'T';
        n = 0;
      }
    }
  }
}
