#include <bits/stdc++.h>
using namespace std;
inline bool IsPrime(long long p) {
  if (p == 1) return false;
  for (long long i = 2; i <= sqrt(p); i++) {
    if (p % i == 0) return false;
  }
  return true;
}
inline long long GetDigit(long long num) { return (long long)log10(num) + 1; }
long long GetDigitsSum(long long num) {
  long long N = 0;
  while (num > 0) {
    N += num % 10;
    num /= 10;
  }
  return N;
}
long long gcd(long long a, long long b) {
  if (a < b) {
    return gcd(b, a);
  } else if (a % b) {
    return gcd(b, a % b);
  } else {
    return b;
  }
}
long long lcm(long long a, long long b) {
  long long g = gcd(a, b);
  return a / g * b;
}
long long combination(long long n, long long r) {
  if (r == 0 || n == r) {
    return 1;
  } else if (r == 1) {
    return n;
  } else {
    return combination(n - 1, r - 1) + combination(n - 1, r);
  }
}
map<long long, long long> prime_factor(long long n) {
  map<long long, long long> res;
  for (long long i = 2; i * i <= n; i++) {
    if (n % i == 0) {
      while (n % i == 0) {
        res[i]++;
        n /= i;
      }
    }
  }
  if (n != 1) res[n] = 1;
  return res;
}
map<long long, long long> prime_factor_ver2(long long n,
                                            map<long long, long long> res) {
  for (long long i = 2; i * i <= n; i++) {
    if (n % i == 0) {
      while (n % i == 0) {
        res[i]++;
        n /= i;
      }
    }
  }
  if (n != 1) res[n]++;
  return res;
}
signed main() {
  cin.tie(0);
  ios::sync_with_stdio(false);
  string s;
  cin >> s;
  long long i = 0;
  long long N = (long long)s.length();
  long long cnt = 0;
  reverse(s.begin(), s.end());
  for (long long i = 0; i < N; i++) {
    if (s[i] == 'S') {
      cnt++;
    } else {
      break;
    }
  }
  cout << cnt * 2 << endl;
  return 0;
}
