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

int main(){
	while(true){
		char S[101];
		cin >> S;
		if(S[0]=='0')
			break;
		int countA=0;
		int countB=0;
		
		for(int i=1;S[i]!='\0';i++){
			if(S[i]=='A')
				countA++;
			else if(S[i]=='B')
				countB++;
		}
		if(countA > countB)
			countA++;
		else if(countA < countB)
			countB++;

		cout << countA <<' '<< countB<<endl;
	}
	return 0;
}