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