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

int main(){
	
	while(true){
		char s[29];
		cin >> s;
		
		if(s[0] == '0') break;
		
		int a=0,b=0;
		
		int len = strlen(s);
		
		for(int i = 1;i < len;i++){
			if(s[i] == 'A'){
			a++;
			}else if(s[i] == 'B'){
			b++;
			}
		}
		if(a >= 10 && b >= 10){
			if(a > b){
			cout << a + 1 << " " << b << endl;
			}else{
			cout << a << " " << b + 1 << endl;
			}
	
		}else if(a == 10){
		cout << 11 << " " << b << endl;
		}else if(b == 10){
		cout << a << " " << 11 << endl;
		}
	}
	
	return 0;
	
}
	
