#include <bits/stdc++.h>
using namespace std;
template <typename T = long long>
inline T IN() {
  T x;
  cin >> x;
  return (x);
}
inline void CIN() {}
template <class Head, class... Tail>
inline void CIN(Head &&head, Tail &&...tail) {
  cin >> head;
  CIN(move(tail)...);
}
const int INF = 1e9;
const int MOD = 1e9 + 7;
const long long LINF = 1e18;
string X;
int ssum;
int main() {
  cin >> X;
  int N = X.length();
  long long ans = 0;
  for (int i = 0; i < (N); ++i) {
    if (X[i] == 'S') {
      ssum++;
    } else {
      ssum--;
      ans += 2;
    }
  }
  cout << N - ans << "\n";
}
