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

int main()
{
	while (1)
	{
		string s;
		cin >> s;
		if (s == "0")break;
		vector<int>ab(2);
		for (int c = 1; c < s.length(); c++) {
			if (s[c] == 'A')ab[0]++;
			else ab[1]++;
		}
		if (ab[0] == 10&&ab[1]<10)cout << 11 << " " << ab[1] << endl;
		else if(ab[1]==10&&ab[0]<10) cout << ab[0] << " " << 11 << endl;
		else if (ab[0] > ab[1])cout << ab[0]+1 << " " << ab[1] << endl;
		else cout << ab[0] << " " << ab[1]+1 << endl;
	}
}