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

bool isFinish(int a, int b) {
  return (abs(a-b) >= 2 && (a >= 11 || b >= 11));
}

int main() {
  while(1) {
    string s;
    for(int i = 0; i < 3; ++i) {
      string t;
      cin >> t;
      if(t == "0") return 0;
      s += t;
    }
    int a = 0, b = 0;
    for(int i = 1; i < s.size(); ++i) {
      if(s[i] == 'A') ++a;
      else ++b;
      if(isFinish(a,b)) {
        cout << a << " " << b << endl;
        a = b = 0;
      }
    }
    if(isFinish(a+1, b)) {
      cout << a+1 << " " << b << endl;
    } else {
      cout << a << " " << b+1 << endl;
    }
  }
  return 0;
}