#include <bits/stdc++.h>
using namespace std;
const int INF = 1 << 30;
int main() {
  string s;
  cin >> s;
  s = 'T' + s + 'S';
  int n = (int)s.size();
  int pos = 0;
  int ns = 0, nt = 0;
  int ans = n - 2;
  while (pos < n) {
    cout << ns << " " << nt << endl;
    if (s[pos] == 'S') {
      if (ns * nt != 0) {
        ans -= 2 * min(ns, nt);
        ns = 1 + max(0, ns - nt);
        nt = 0;
      } else {
        ns++;
      }
    } else {
      if (ns != 0) nt++;
    }
    pos++;
  }
  cout << ans << endl;
}
