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