#include <bits/stdc++.h>
#define FOR(i,a,b) for(int i=(a);i<(b);i++)
#define RFOR(i,a,b) for(int i=(b) - 1;i>=(a);i--)
#define REP(i,n) for(int i=0;i<(n);i++)
#define RREP(i,n) for(int i=n-1;i>=0;i--)

#define PB push_back
#define INF INT_MAX/3
#define ALL(a) (a).begin(),(a).end()
#define CLR(a) memset(a,0,sizeof(a))

typedef long long int ll;

using namespace std;

int main(){
    string s;
    cin >> s;
    while(true){
	if(s == "0") break;
	int a,b;
	a = 0;
	b = 0;
	for(int i=1;i<s.size();i++){
	    if(s[i] == 'A'){
		a++;
	    }else{
		b++;
	    }
	}
	cin >> s;
	if(s[0] == 'A') a++;
	else if(s[0] == 'B') b++;
	else if(s[0] == '0'){
	    if(a >= 10 && b >= 10){
		if(a > b){
		    b = a + 2;
		}else{
		    a = b + 2;
		}
	    }else{
		if(a > b) a = 11;
		else b = 11;
	    }
	}
	printf("%d %d\n",a,b);
    }
    return 0;
}