#include <bits/stdc++.h>
using namespace std;
int n;
char s[1000001];
int last;
int ans;
int main() {
  gets(s);
  n = strlen(s);
  int last = -1, kol = 0;
  for (int i = 0; i < n; ++i) {
    if (s[i] == 'F') {
      if (last == -1)
        ans = i;
      else if (ans >= kol && kol)
        ans = ans + 1;
      else
        ans = kol;
      last = i;
    } else
      ++kol;
  }
  printf("%d\n", ans);
  return 0;
}
