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

int main(){
	string serve;
	int APoint = 0;
	int BPoint = 0;
	while(true){
		cin >> serve;
		if(serve == "0"){
			break;
		}
		int size = serve.size();
		APoint = 0;
		BPoint = 0;
		
		for(int i=1;i<size;i++){
			if(serve[i] == 'A'){
				APoint++;
			}else if(serve[i] == 'B'){
				BPoint++;
			}
		}
		
		if(APoint > BPoint){
			APoint++;
		}else{
			BPoint++;
		}
		
		cout << APoint << ' ' << BPoint << '\n';
	}
	return 0;
}