#include <string>
#include <iostream>
#include <vector>
using namespace std;

int solve() {
  vector<string> vs(3);
  cin >> vs[0];
  if(vs[0] == "0") return 1;
  cin >> vs[1] >> vs[2];

  for(int k=0; k<3; k++) {
    int N = vs[k].length();
    int sa = 0, sb = 0;
    for(int i=1; i<N; i++) {
      if(vs[k][i] == 'A') sa++;
      if(vs[k][i] == 'B') sb++;
    }
    if(k < 2) {
      if(vs[k+1][0] == 'A') sa++;
      if(vs[k+1][0] == 'B') sb++;
    }
    else {
      if(sa >= 10 and sb >= 10) {
        if(sa > sb) sa++;
        else sb++;
      }
      else {
        if(sa == 10) sa++;
        if(sb == 10) sb++;
      }
    }
    printf("%d %d\n", sa, sb);
  }
  return 0;
}

int main() {
  while(!solve());
}

