#include <bits/stdc++.h>
using namespace std;
using ll = long long;
int main() {
  string S;
  cin >> S;
  if (S.at(0) == 'S') {
    cout << 0 << endl;
    return 0;
  }
  int N = S.size();
  int i = N - 1;
  while (S.at(i) == 'S') {
    i--;
  }
  cout << (N - i - 1) * 2 << endl;
  return 0;
}
