#include <bits/stdc++.h>
using namespace std;

int main() {
  string s;
  while (cin >> s, s != "0") {
    int a = 0, b = 0;
    for (int i = 0; i < s.size() - 1; i++) {
      if (s[i + 1] == 'A') a++;
      else b++;
    }
    if (a > b) a++;
    else b++;
    cout << a << " " << b << "\n";
  }
}
