#include <bits/stdc++.h>
using namespace std;
int main() {
  string a;
  cin >> a;
  long long n = a.length();
  long long ear = 0, b = 0;
  for (long long i = 0; i < n; i++) {
    if (a[i] == 'F') {
      if (ear >= b && b != 0)
        ear++;
      else
        ear = b;
    } else {
      b++;
    }
  }
  cout << ear << endl;
  return 0;
}
