#include <bits/stdc++.h>
int main(void) {
  int i, len = 0, count = 0;
  char ch[200000];
  scanf("%s", ch);
  for (i = 0; (ch[i] != '\0'); i++) {
    len++;
    if ((i <= ((len / 2) + 1)) && (ch[i] == 'S')) {
      count++;
    }
  }
  printf("%d\n", (len - (count * 2)));
  return 0;
}
