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

int main() {
	string s;
	while (cin >> s) {
		if (s == "0")break;

		int a = s.size();
		int ap = 0, bp = 0;
		for (int i = 1;i < a;i++) {
			if (s[i] == 'A')ap++;
			else bp++;
		}
		if (ap < bp)bp++ ;
		else ap++;
		cout << ap << ' ' << bp << endl;
	}
	return 0;
}