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