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

int main(){
	char serve[3][101];
	char latestServe;
	int APoint[3];
	int BPoint[3];
	bool isDeuce = false;
	while(true){
		cin >> serve[0];
		if(strlen(serve) == 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]=='A'){
					APoint[i]++;
				}else if(serve[i]=='B'){
					BPoint[i]++;
				}else if(serve[i]=='\0'){
					break;
				}
			  latestServe = serve[i];
				if(APoint == BPoint && APoint == 10){
					isDuce = true;
				}
			}
			if(isDuce){
				if(latestDuce == 'A'){
					APoint[i]++;
				}else{
					BPoint[i]++;
				}
			}else{
				if(APoint[i] > BPoint[i]){
					APoint[i]++;
				}else{
					BPoint[i]++;
				}
			}
			isDuce = false;
			cout << APoint[i] << ' ' << BPoint[i] << '\n';
		}
	}
	return 0;
}