#include<bits/stdc++.h>
using namespace std;
int main(void)
{
	int i,j,k,a,b,cnt,s1[3],s2[3];
	char sabu[102];
	while(1) {
		cnt=0;
		for(i=0;i<3;i++) {
			cin>>sabu;
			if(sabu[0]=='0') {
				cnt=1;
				break;
			}
			a=b=0;
			for(j=1;j<strlen(sabu);j++) {
				if(sabu[j]=='A')a++;
				else b++;
				if(a==b&&a>10) a=b=10;					
			}
			if(a>b)s1[i]=a+1,s2[i]=b;
			else s1[i]=a,s2[i]=b+1;

		}
		if(cnt==1) break;
		for(i=0;i<3;i++) cout<<s1[i]<<" "<<s2[i]<<endl;
	}
	return 0;
}