#include<iostream>
#include<cstring>
using namespace std;
int main(){
	int h,box[2];
	char s[100];
	while(1){
		box[0]=0;
		box[1]=0;
		cin>>s;
		if(s[0]=='0')
			break;
		h=strlen(s);
		for(int i=0;i<h-1;i++)
		box[s[i+1]-'A']++;
		if(box[0]>box[1])
		box[0]++;
		else box[1]++;
		cout<<box[0]<<' '<<box[1]<<endl;
	}
	return 0;
}