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

#define loop(i,a,b) for(int i=a;i<b;i++)
#define rep(i,a) loop(i,0,a)

int main(){
	int a,b;
	string input;
	while(getline(cin,input),input!="0"){
		a=b=0;
		rep(i,input.size())	{
			if(input[i]=='A')a++;
			if(input[i]=='B')b++;
		}
		if(a<11 || b<11){
			if(a==10){a++;b--;}
			else if(b==10){b++;a--;} 
			cout<<a<<" "<<b;
		}
		else if(input[input.size()-1]=='A')cout<<a+1<<" "<<b-1;
		else cout<<a-1<<" "<<b+1;
		
		cout<<endl;
		
	}

}