#include <iostream>
#include <cstring>
using namespace std;

int main()
{
while(1){
	char s[100];
	int a=0,b=0,i,j;

	cin >> s;
if(s[0]=='0'&&s[1]=='\0')break;

		if(s[0]=='A')a=a-1;
		if(s[0]=='B')b=b-1;	
for(i=0;s[i]!='\0';i++){
		if(s[i]=='A')a=a+1;
		
		if(s[i]=='B')b=b+1;
		
}
if(a>b){a=a+1;
}else{ b=b+1;}


cout<<a<<" "<<b<<endl;
}
return 0;

}