#include <bits/stdc++.h>
using namespace std;
char str[200005];
int main() {
  for (int i = 0; i < 200005; i++) {
    str[i] = '+';
  }
  cin >> str;
  int i = 0;
  for (; i < 200005; i++) {
    if (str[i] == '\0') break;
  }
  int counts, countt;
  counts = 0, countt = 0;
  for (int j = 0; j <= (i - 2) / 2; j++) {
    if (str[j] == 'S') counts++;
  }
  cout << i - (counts * 2);
}
