#include <bits/stdc++.h>
using namespace std;
long long MM = 1000000000;
long long mod = MM + 7;
long long MMM = 9223372036854775807;
long long GCD(long long x, long long y) {
  if (y == 0)
    return x;
  else
    return GCD(y, x % y);
}
long long LCM(long long x, long long y) { return x / GCD(x, y) * y; }
template <class T>
inline bool chmin(T& a, T b) {
  if (a > b) {
    a = b;
    return true;
  }
  return false;
}
template <class T>
inline bool chmax(T& a, T b) {
  if (a < b) {
    a = b;
    return true;
  }
  return false;
}
const long long INF = 1LL << 60;
int main() {
  string s;
  cin >> s;
  reverse(s.begin(), s.end());
  long long cnt = 0;
  for (long long i = 0; i < s.size(); i++) {
    if (s[i] == 'T')
      break;
    else
      cnt++;
  }
  cout << 2 * cnt << endl;
}
