#include<iostream>
#include<cstdio>
#include<algorithm>
#include<climits>
#include<string>
#include<vector>
#include<list>
#include<map>
#include<set>
#include<cmath>
#include<queue>
#include<cstring>
#include<stack>
#include<functional>
using namespace std;

int main(){
	while(true){
		int A = 0, B = 0;
		for(int g=0;g<3;g++){
			A = 0; B = 0;
			for(int i=0;;i++){
				char c; scanf("%c",&c);
				if(c=='0') return 0;
				if(i==0) continue;
				if(c=='\n'){
					if(A>B) A++;
					else B++;
					printf("%d %d\n",A,B); break;
				}
				if(c=='A') A++;
				else if(c=='B') B++;
			}
		}
	}
	return 0;
}