#include <bits/stdc++.h>
using namespace std;
bool is_prime(int n) {
  for (int i = 2; i * i <= n; i++) {
    if (n % i == 0) return false;
  }
  return true;
}
template <class T>
inline bool chmin(T& a, T b) {
  if (a > b) {
    a = b;
    return true;
  }
  return false;
}
template <class T>
inline bool chmax(T& a, T b) {
  if (a < b) {
    a = b;
    return true;
  }
  return false;
}
int main() {
  string X;
  cin >> X;
  bool flag = false;
  while (true) {
    for (int i = 0; i < X.length() - 1; i++) {
      if (X[i] == 'S' && X[i + 1] == 'T') {
        flag = true;
        X.erase(X.begin() + i);
        cout << X.length() << endl;
        if (X.length() == 1) {
          flag = false;
          X.pop_back();
          break;
        } else {
          X.erase(X.begin() + i);
          break;
        }
      }
      flag = false;
    }
    if (flag == false) {
      break;
    }
  }
  cout << X.length() << endl;
  return 0;
}
