#include <bits/stdc++.h>
using namespace std;
int main() {
  string X;
  cin >> X;
  reverse(X.begin(), X.end());
  long long count = 0;
  for (auto c : X) {
    if (c == 'S')
      ++count;
    else
      break;
  }
  cout << 2 * count << endl;
}
