#include <bits/stdc++.h>
using namespace std;
int main() {
  string s;
  cin >> s;
  for (int i = s.length() - 1; i >= 0; i--) {
    if (s[i] == 'T') {
      cout << (s.length() - 1 - i) * 2 << endl;
      break;
    }
  }
  return 0;
}
