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