#include <bits/stdc++.h>
using namespace std;
const long long MOD = pow(10, 9) + 7;
const long long LLINF = pow(2, 61) - 1;
const int INF = pow(2, 30) - 1;
int main() {
  string X;
  cin >> X;
  int l = X.length();
  int result = 0, num = 0;
  for (int i = 0; i < (int)l; i++) {
    num += (X[i] == 'S') ? -1 : 1;
    result = max(result, num);
  }
  cout << result << endl;
  return 0;
}
