#include <bits/stdc++.h>
using namespace std;
int main() {
  string X;
  cin >> X;
  int N = X.size();
  int Tnum = N / 2;
  int ans = 0, tct = 0, sct = 0;
  for (int i = 0; tct < Tnum; i++) {
    if (X[i] == 'S')
      sct++;
    else
      tct++;
  }
  cout << N - 2 * sct << endl;
}
