#include<stdio.h>
#include<string.h>
char c[101];
int main(){
	while(scanf("%s",c)){
		if(c[0]=='0')return 0;
		int count=0,a=0,b=0;
		for(int i=1;i<strlen(c);i++){
			if(c[i]=='A')a++;
			else b++;
		}
		if(a>b)a++;
		else b++;
		printf("%d %d\n",a,b);
	}
}
