// 2011/06/30 Tazoe

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

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

		int pntA = 0;
		int pntB = 0;
		for(int i=1; i<srv.size(); i++)
			if(srv[i]=='A')
				pntA++;
			else
				pntB++;

		if(pntA>pntB)
			pntA++;
		else
			pntB++;

		cout << pntA << ' ' << pntB << endl;
	}

	return 0;
}