#include <bits/stdc++.h>
using namespace std;
string s;
int main() {
  while (cin >> s) {
    int cnt = 0, ans = -1;
    for (int i = 0; i < s.size(); i++) {
      if (s[i] == 'F') {
        if (i - cnt) ans = max(ans + 1, i - cnt);
        cnt++;
      }
    }
    if (ans < 0) ans = 0;
    cout << ans << endl;
  }
  return 0;
}
