#include <bits/stdc++.h>
using namespace std;
using ii = tuple<long long, long long>;
const long long N = 1e6 + 7, inf = 1e9 + 42;
long long binpow(long long a, long long b) {
  if (b == 0) return 1;
  long long res = binpow(a, b / 2);
  if (b % 2)
    return (res * res * a);
  else
    return (res * res);
}
bool compare(pair<long long, long long> a, pair<long long, long long> b) {
  if (a.first == b.first)
    return (a.second > b.second);
  else
    return (a.first <= b.first);
}
signed main() {
  ios_base::sync_with_stdio(false);
  cin.tie(NULL);
  cout.tie(NULL);
  string s;
  cin >> s;
  long long n = s.length(), indx = 0, pre = -1, ans = 0, temp;
  for (long long i = 0; i < n; i++) {
    if (s[i] == 'F') {
      if (i == indx) {
        pre = 0;
        indx++;
      } else {
        temp = i - indx;
        if (pre + 1 > temp) temp = pre + 1;
        if (temp > ans) ans = temp;
        pre = temp;
        indx++;
      }
    }
  }
  cout << ans << endl;
}
