#include <bits/stdc++.h>
using namespace std;
using ll = long long;
const long long MOD = (long long)(1e9 + 7);
const long long INF = (long long)(1e13 + 7);
long long ceil_(long long a, long long b) { return (a + (b - 1)) / b; }
long long positive_surplus(long long &a) { return (a + MOD) % MOD; }
long long bpm(long long x, unsigned long long y) {
  if (x == 0) return 0;
  if (y == 0) return 1;
  long long ans = 1;
  long long digit = (long long)((log((double)y) / log((double)2) / 1 + 1));
  x %= MOD;
  for (unsigned long long i = 0; i < digit; i++) {
    if (((y >> i) & 1u) == 1) ans = ans * x % MOD;
    x = x * x % MOD;
  }
  return ans;
}
template <class T>
void cumulative_sum(T &container) {
  for (long long i = 0; i < container.size() - 1; i++)
    container[i + 1] += container[i];
}
vector<long long> non_duplication;
template <class T>
void without_duplication(T a) {
  non_duplication.emplace_back(a[0]);
  for (long long i = 1; i < a.size(); i++)
    if (a[i] != a[i - 1]) non_duplication.push_back(a[i]);
}
signed main() {
  string X;
  cin >> X;
  vector<char> Xs;
  for (long long i = 0; i < (long long)(X.size()); i++) {
    Xs.emplace_back(X[i]);
  }
  without_duplication(Xs);
  if (Xs[0] == 'S') {
    cout << 0 << endl;
  } else {
    cout << non_duplication.size() << endl;
  }
}
