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