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