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

int main(){
	char ta[1000];
	int a,b;

	while(true){
	for(int i=0;i<3;i++){
	cin>>ta;
	if(strcmp(ta,"0")==0)return 0;
	a=b=0;
		for(int j=1;ta[j]!='\0';j++){
		(ta[j]=='A')?a++:b++;
		}
		(a>b)?a++:b++;
		cout<<a<<" "<<b<<endl;
	}
	}


	return 0;
}