#include<cstdio>
#include<cstring>
using namespace std;
int main(){
	char str[1024];
	int cnt = -1;
	int a = 0,b = 0;
	while(scanf("%s",str),true){
		if(++cnt % 3 != 0){
			(str[0] == 'A') ? a++ : b++;
			printf("%d %d\n",a,b);
			a = 0,b = 0;
		}
		else if(cnt != 0){
			if(a > b)a++;
			else b++;
			if(str[0] == '0'){
				printf("%d %d\n",a,b);
				break;
			}
			printf("%d %d\n",a,b);
			a = 0,b = 0;
		}
		int len = strlen(str);
		for(int i = 1; i < len; i++){
			(str[i] == 'A') ? a++ : b++;
		}
	}
	return 0;
}