#include <bits/stdc++.h>
using namespace std;
const int INF = 1000 * 1000 * 1000 + 7;
const double EPS = 1e-9;
const double PI = acos(-1.0);
template <class T>
int chmin(T &t, T f) {
  return (t > f) ? (t = f, 1) : 0;
}
template <class T>
int chmax(T &t, T f) {
  return (t < f) ? (t = f, 1) : 0;
}
inline int getint() {
  int a;
  return scanf("%d", &a) ? a : (fprintf(stderr, "trying to read\n"), -1);
}
inline double getdouble() {
  double a;
  return scanf("%lf", &a) ? a : (fprintf(stderr, "trying to read\n"), -1);
}
void myCode() {
  string s;
  cin >> s;
  int ret = 0, num = 0;
  for (int i = (int)(0); i < (int)(((int)(s).size())); i++)
    if (s[i] == 'F') {
      if (i != num) chmax(ret, max(ret + 1, i - num));
      ++num;
    }
  printf("%d\n", ret);
}
int main() {
  myCode();
  return 0;
}
