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