#include <bits/stdc++.h>
using namespace std;
const long long mod = 1000000007;
const long long INF = 10e12;
const long long inf = -1;
long long ABS(long long a) { return max(a, -a); }
int main(void) {
  string X;
  cin >> X;
  for (long long i = 0; i < X.size(); i++) {
    if (X.at(X.size() - 1 - i) == 'T') {
      cout << 2 * i << endl;
      return 0;
    }
  }
}
