#include <bits/stdc++.h>
using namespace std;
char s[1000000 + 3];
int n, st, ans;
int main() {
  scanf("%s", s + 1);
  n = strlen(s + 1);
  st = 1;
  for (; s[st] == 'F'; st++)
    ;
  for (int i = st + 1; i <= n; i++)
    if (s[i] == 'F') ans = max(ans + 1, i - st), st++;
  printf("%d", ans);
}
