#include <bits/stdc++.h>
using namespace std;
using ll = long long;
const ll mod = 1000000007;
int main() {
  string s;
  cin >> s;
  ll n = s.size();
  ll count = 0;
  for (ll i = n - 1; i >= 0; i--) {
    if (s[i] == 'T') break;
    count++;
  }
  cout << count * 2 << endl;
}
