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