#include <bits/stdc++.h>
using namespace std;
double EPS = 1e-10;
int main() {
  string str;
  cin >> str;
  ;
  string::iterator it = str.begin();
  bool check = false;
  while (true) {
    if (*it == 'S') {
      if (*(it + 1) == 'T') {
        str.erase(it, it + 2);
        check = true;
      }
    }
    if (it == str.end()) {
      if (!check || str.length() == 0) break;
      it = str.begin();
      check = false;
    } else
      it++;
  }
  cout << str.length() << endl;
  cout << str << endl;
  while (1)
    ;
  return 0;
}
