#include <iostream>
using namespace std;
int main(void){
	string s;
	while(cin>>s,s!="0"){
		for(int i=0;i<3;++i){
			if(i)cin>>s;
			int a=0,b=0;
			for(int j=1;j<s.size();++j){
				if(s[j]=='A') ++a;else ++b;
			}
			if(a>b) ++a;else ++b;
			cout<<a<<" "<<b<<endl;
		}
	}
	return 0;
}