#include <bits/stdc++.h>
using namespace std;
string r;
int main() {
  ios::sync_with_stdio(0);
  cin.tie(0);
  string s;
  cin >> s;
  for (long long i = 0; i < ((long long((s).size()))); ++i) {
    if ((long long((r).size())) == 0 || r.back() == 'T' || s[i] == 'S')
      r.push_back(s[i]);
    else
      r.pop_back();
  }
  cout << r << endl;
  return 0;
}
