#include <bits/stdc++.h>
using namespace std;
using ll = long long;
const int inf = 1e9 + 7;
const ll longinf = 1LL << 60;
const ll mod = 1e9 + 7;
int main() {
  string S;
  cin >> S;
  int N = S.size();
  int ans;
  for (int i = N - 1; i >= 0; i--) {
    if (S[i] == 'T') {
      ans = N - i - 1;
      break;
    }
  }
  cout << 2 * ans << endl;
}
