#include <bits/stdc++.h>
using namespace std;
const int N = 1000050;
int n;
char str[N];
int main() {
  scanf("%s", str);
  n = strlen(str);
  int l = 0;
  while (str[l] == 'F') l++;
  int ans = 0;
  int counts = 0, last = 0;
  for (int i = l; i < n; i++) {
    if (str[i] == 'F') {
      int need = i - l - counts;
      counts++;
      if (need <= last) need = last + 1;
      last = need;
      ans = max(ans, need);
    }
  }
  printf("%d\n", ans);
  return 0;
}
