#include <bits/stdc++.h>
using namespace std;
int main() {
  string s;
  getline(cin, s);
  long long n = s.size(), t = 0;
  string k;
  for (int i = 0; i < s.size(); i += 2) {
    k = s[i];
    k += s[i + 1];
    if (k == "TT" or k == "SS") break;
    t = i + 2;
  }
  cout << n - t;
  return 0;
}
