#include <bits/stdc++.h>
using namespace std;
const int MAXN = 1e6 + 5;
int n, m, ans, x[MAXN];
char s[MAXN];
int main() {
  scanf("%s", s);
  int n = strlen(s);
  bool ok = true;
  int cnt = 0;
  for (int i = 1; i <= n; i++)
    if (s[i - 1] == 'F') {
      if (!ok)
        x[++m] = i;
      else
        cnt++;
    } else
      ok = false;
  ans = 0;
  for (int i = 1; i <= m; i++)
    if (x[i] - (i + cnt) > ans)
      ans = x[i] - (i + cnt);
    else
      ans++;
  printf("%d\n", ans);
}
