#include <bits/stdc++.h>
using namespace std;
int main() {
  string a;
  cin >> a;
  for (int b = 0; b < a.length() - 1; b++) {
    if (a.length() == 0) break;
    if (a[b] == 'S' && a[b + 1] == 'T') {
      string d = "";
      for (int c = 0; c < a.length(); c++) {
        if (c != b && c != b + 1) d += a[c];
      }
      a = d;
      b = -1;
    }
    cout << a.length() << endl;
  }
}
