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