#include <iostream>
#include <string>

using namespace std;

void solve()
{
	string str;
	while(cin >> str, str != "0")
	{
		int size = str.size();
		int countA = 0;
		int countB = 0;
		for(int i = 1; i < size; ++i)
		{
			str[i] == 'A' ? countA++ : countB++;
		}
		countA > countB ? countA++ : countB++;
		cout << countA << " " << countB << endl;
	}
}

int main()
{
	solve();
	return(0);
}