#include <bits/stdc++.h>
using namespace std;
string x;
int main() {
  cin >> x;
  int n = x.size();
  int cnt = 0;
  for (int i = n - 1; i >= 0; i--) {
    if (x.at(i) == 'T') {
      break;
    }
    cnt++;
  }
  cerr << cnt << endl;
  cout << cnt * 2 << endl;
  return 0;
}
