#include<iostream>

char service[3][101];
int point[2];

void solve(int n){
	point[0]=0;
	point[1]=0;
	for(int i=1; service[n][i]!='\0'; i++){
		if(service[n][i]=='A')
			point[0]++;
		else
			point[1]++;
	}
	if(n==2){
		if(point[0]>point[1])
			point[0]++;
		else
			point[1]++;
	}
	else{
		if(service[n+1][0]=='A')
			point[0]++;
		else
			point[1]++;
	}
}

int main(){
	while(true){
		for(int i=0; i<3; i++){
			std::cin >> service[i];
			if(service[0][0] == '0')
				return 0;
		}
		for(int i=0; i<3; i++){
			solve(i);
			std::cout << point[0] << ' ' << point[1] << std::endl;
		}
	}
}