#include <iostream>
#include <cstring>
using namespace std;
int main(){

while(true){
		char g1[101],a;
		cin>>g1;
	if(strcmp(g1,"0")==0){
		break;
	}
	int As=0,Bs=0;
		for(int i=1;g1[i]!='\0';i++){
			a=g1[i];
			if(a=='A'){
				As++;
			}
			else{
				Bs++;
			}
		}
		if(As>Bs){
			As++;
		}
		else{
			Bs++;
		}
		cout<<As<<" "<<Bs<<endl;
		As=0;
		Bs=0;
}

return 0;
}