#include <bits/stdc++.h>
using namespace std;
const long long mod = 1000000007;
const long long INF = (long long)1000000007 * 1000000007;
const long double eps = 1e-8;
const long double pi = acos(-1.0);
string x;
void solve() {
  cin >> x;
  int n = x.length();
  int ans = 0;
  for (int i = n - 1; i >= 0; i--) {
    if (x[i] == 'T') break;
    ans += 1;
  }
  cout << 2 * ans << endl;
}
int main() {
  ios::sync_with_stdio(false);
  cin.tie(0);
  solve();
}
