#include <bits/stdc++.h>
using namespace std;
long long GCD(long long a, long long b) {
  if (b == 0) return a;
  return GCD(b, a % b);
}
long long LCM(long long a, long long b) { return a / GCD(a, b) * b; }
long long mypow(long long a, long long b, long long c) {
  if (b == 0) return 1;
  if (b % 2)
    return mypow(a, b - 1, c) * a % c;
  else
    return mypow(a, b / 2, c) * mypow(a, b / 2, c) % c;
}
signed main() {
  string s;
  cin >> s;
  long long x = 0;
  for (long long i = 0; i < (s.size()); i++) {
    if (s[i] == 'S')
      x++;
    else
      x = 0;
  }
  cout << x * 2 << endl;
  return 0;
}
