#include <stdio.h>
#include <iostream>
#include <string>

using namespace std;

int main() {
	string a;
	int k;
	int A,B;
	int counter = 0;
	while (cin >> a) {
		if (a[0] == '0') {
			break;
		}
		k = a.size();
		A = 0;
		B = 0;
		for (int i = 1; i < k; i++) {
			if (a[i] == 'A') {
				A++;
			} else {
				B++;
			}
		}
		if (A > B) {
			A++;
		} else {
			B++;
		}
		cout << A << " " << B << endl;
	}
	return 0;
}