#include <bits/stdc++.h>
using namespace std;
template <typename T>
void remove(std::vector<T>& vector, unsigned int index) {
  vector.erase(vector.begin() + index);
}
int main() {
  string s;
  cin >> s;
  int cont = 0;
  for (int i = s.size(); i > s.size() / 2; i--) {
    if (s[i - 1] == 'S')
      cont++;
    else
      break;
  }
  cout << 2 * cont << endl;
}
