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