#include <bits/stdc++.h>
using namespace std;
int main() {
  string X;
  cin >> X;
  reverse((X).begin(), (X).end());
  long long ans = 0;
  for (long long i = 0; i < (long long)X.size(); ++i) {
    if (X[i] == 'T') {
      break;
    }
    ans += 2;
  }
  cout << ans << endl;
  return 0;
}
