#include <bits/stdc++.h>
using namespace std;
int main() {
  int c;
  int r = 0;
  int ll = 0;
  cout << "enter a sentence:" << endl;
  while ((c = cin.get()) > 10) {
    if (c == 'S')
      if (r < 0)
        r = -r + 1;
      else
        r++;
    else if (r <= ll) {
      r++;
      ll++;
    } else
      r--;
  }
  cout << r << endl;
  return 0;
}
