// 2011/02/17 Tazoe

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

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

		int A = 0;
		int B = 0;
		for(int i=1; i<gam.size(); i++)
			if(gam[i]=='A')
				A++;
			else
				B++;

		if(A>B)
			A++;
		else
			B++;

		cout << A << ' ' << B << endl;
	}

	return 0;
}