#include <bits/stdc++.h>
using namespace std;
using ll = long long;
void main_() {
  string X;
  cin >> X;
  auto pos = X.find_last_of('T');
  cout << 2 * (X.size() - pos - 1) << endl;
}
int main() {
  cin.tie(nullptr);
  cout.tie(nullptr);
  ios_base::sync_with_stdio(false);
  main_();
  return 0;
}
