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

int main() {
  string record;
  while (true) {
    cin >> record;
    if (record[0]=='0') {
      break;
    }
    int a = 0, b = 0;
    for (int j=0; j<record.size(); j++) {
      if (j>0 && record[j]=='A') {
	a++;
      } else if (j>0 && record[j]=='B') {
	b++;
      }
    }
    if (a>b) {
      a++;
    } else if (b>a) {
      b++;
    }
    cout << a << " " << b << endl;
  }
  return 0;
}