#include <bits/stdc++.h>
using namespace std;
using ld = long double;
using ll = long long;
const ll INF = 100100100100100;
ll gcd(ll a, ll b) {
  if (a < b) swap(a, b);
  if (a % b == 0)
    return b;
  else
    return gcd(b, a % b);
}
int main() {
  string S;
  cin >> S;
  ll size = S.size();
  ll ans = 0;
  for (int i = size - 1; i >= size / 2 - 1; i--) {
    if (S[i] == 'T') break;
    ans++;
  }
  cout << ans * 2 << endl;
}
