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