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