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