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