#include <bits/stdc++.h>
using namespace std;
int Mysubstring(char* str_in, char* str_sub, char* str_out) {
  int start = 0;
  int count = 0;
  int j = 0;
  int k = 0;
  int answer;
  for (int i = 0; str_in[i] != '\0'; i++) {
    start = i;
    j = 0;
    while ((str_in[i] != '\0') && (str_sub[j] != '\0') &&
           (str_in[i] == str_sub[j])) {
      i++;
      j++;
    }
    if (str_sub[j] != '\0') {
      str_out[k++] = str_in[start];
      i = start;
    } else {
      count++;
      i--;
    }
  }
  answer = sizeof(str_out);
  return answer;
}
int main() {
  char* str_in;
  scanf("%s", str_in);
  char* str_sub = "ST";
  char str_out[100] = {0};
  int answer = Mysubstring(str_in, str_sub, str_out);
  printf("%d\n", answer / 2);
  return 0;
}
