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