#include <bits/stdc++.h>
using namespace std;
const double EPS = 1e-10;
const double PI = acos(-1.0);
const int MOD = 1000000007;
int main(int argc, char const* argv[]) {
  string x;
  cin >> x;
  cout << (x.size() - 1 - x.rfind('T')) * 2 << endl;
  return 0;
}
