#include <bits/stdc++.h>
using namespace std;
long long gcd(long long x, long long y) {
  if (y == 0) return x;
  return gcd(y, x % y);
}
long long lcm(long long x, long long y) { return x / gcd(x, y) * y; }
string s;
long long n;
signed main() {
  cin >> s;
  for (long long i = s.size() - 1; i >= 0; i--) {
    if (s[i] == 'T')
      break;
    else {
      n++;
    }
  }
  cout << n * 2 << endl;
  getchar();
  getchar();
  return 0;
}
