#include <bits/stdc++.h>
using namespace std;
int main() {
  string s;
  int n = s.size();
  bool a;
  for (int i = 0; i < s.size(); i++) {
    if (s[i] == 'S')
      a = true;
    else {
      if (a) n = n - 2;
      a = false;
    }
  }
  cout << n << endl;
}
