#include<iostream>
#include<string>
using namespace std;
int main() {
	string c;
	while (cin >> c&&c != "0") {
		int a=0, b=0;
		for (int i = 1; i < c.length(); i++) {
			if (c[i] == 'A')
				a++;
			else
				b++;
		}
		if (a  > b) a++;
		else if (b  > a) b++;
		cout << a << " " << b << endl;
	}
}