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