#include<iostream>
#include<cstdio>
#include <cstring>
#include<map>
#include<string>
using namespace std;

int main(void){
	string a;
	while(1)
	{
		cin>>a;
		if(a=="0")break;
		a[0]='z';
		string::iterator str = a.begin();
		int A=0,B=0;
		for( str = a.begin(); str != a.end(); ++str )
		{
			if( 'A' == *str ) ++A;
			if( 'B' == *str ) ++B; 
		}
		if(A<B) ++B;
		else ++A;
		cout<<A<<" "<<B<<endl;
		a.clear();
	}
	return 0;
}