#include<stdio.h>
#include<string.h>

int main(){
	char ss[40];
	int i,j,a,b;
	
	while(~scanf(" %s ",ss)){
		if(ss[0]=='0')break;
		i=1;
		a=0;
		b=0;
		while(1){
			if(ss[i]=='\0')break;
			if(ss[i]=='A')++a;
			if(ss[i]=='B')++b;
			++i;
		}
		if(a>b){
			++a;
		}else{
			++b;
		}
		printf("%d %d\n",a,b);
	}
	return 0;
}