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

int main(){
	char serve[3][101];
	char latestServe;
	int APoint;
	int BPoint;
	bool isDeuce = false;
	while(true){
		cin >> serve[0];
		if(strlen(serve[0]) == 1){
			break;
		}
		cin >> serve[1] >> serve[2];
		APoint = 0;
		BPoint = 0;
		
		for(int i=0;i<3;i++){
			for(int j=1;j<101;j++){
				if(serve[i][j]=='A'){
					APoint++;
				}else if(serve[i][j]=='B'){
					BPoint++;
				}else if(serve[i][j]=='\0'){
					break;
				}
			  latestServe = serve[i][j];
				if(APoint == BPoint && APoint == 10){
					isDeuce = true;
				}
			}
			if(isDeuce){
				if(latestServe == 'A'){
					APoint++;
				}else{
					BPoint++;
				}
			}else{
				if(APoint > BPoint){
					APoint++;
				}else{
					BPoint++;
				}
			}
			isDeuce = false;
			cout << APoint << ' ' << BPoint << '\n';
			APoint = 0;
			BPoint = 0;
		}
	}
	return 0;
}