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

int main()
{
	string str;
	while(cin >> str){
		if(str[0]=='0')
			break;
		int Ap=0,Bp=0;
		for(unsigned i=1;i<str.size();i++){
			if(str[i] == 'A')
				Ap++;
			else if(str[i] == 'B')
				Bp++;
		}
		if(Ap > Bp)
			Ap++;
		else
			Bp++;
		cout << Ap << " " << Bp << endl;
	}
	return 0;
}