import std.stdio;

void main(){
	string s;
	while(1){
		int[char] p[3];
		for(int i=0;i<3;i++)p[i]['A'] = 0, p[i]['B'] = 0;
		for(int i=0;i<3;i++){
			s = readln();
			if(s == "0\n")return;
			for(int j=1;j<s.length;j++){
				p[i][s[j]]++;
			}
			p[i][(p[i]['A']>p[i]['B']?'A':'B')]++;
		}
		for(int i=0;i<3;i++)
			writeln(p[i]['A'], " ", p[i]['B']);
	}
}