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