#include<iostream>

using namespace std;

int main()
{
 while(1){
 char str[150];
 int pointA=0;
 int pointB=0;
 int j=1;
 cin>>str;
 if(str[0]=='0'){break;}
 while(str[j]!='\0'){
	if(str[j]=='A'){
		pointA++;}
	if(str[j]=='B'){
		pointB++;}
	j++;
 }
 if(pointA>pointB)pointA++;
 if(pointA<pointB)pointB++;
 cout<<pointA<<' '<<pointB<<'\n';
 }
return 0;
}