#include <iostream>
#include <vector>
#include <string>
#include <algorithm>

#define REP(i,k,n) for(int i=k;i<n;i++)
#define rep(i,n) for(int i=0;i<n;i++)

using namespace std;

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

		int pa = 0,pb = 0;

		REP(i,1,s.size())
		{
			if(s[i] == 'A') pa++;
			if(s[i] == 'B') pb++;
		}

		if(pa > pb) pa++;
		else pb++;

		cout << pa << " " << pb << endl;
	}
	return 0;
}