#include <bits/stdc++.h>
using namespace std;
int main() {
  string s;
  cin >> s;
  int a = s.length();
  long i, ans = 0;
  for (i = a - 1; i >= 0; i--) {
    if (s[i] == 'T') {
      break;
    }
    ans++;
  }
  printf("%ld\n", 2 * ans);
  return 0;
}
