#include<iostream>
#include<string.h>
#include<algorithm>
#include<stdio.h>
using namespace std;
int i,j,counta=0,countb=0,bx;
    string str;
bool bo=false;
void duce();
int main(){
    for(i=1;;i++){
            getline(cin,str);
        if(str[0]=='0'){
            break;
        }
            for(j=1;j<str.size();j++){
            if(counta==10 && countb==10){
                duce();
                bo=true;
                break;
            }
            else if(str[j]=='A'){
                counta++;
            }
            else if(str[j]=='B'){
                countb++;
            }
        }
        if(bo){
            bo=false;
        }
        else if(counta<countb){
            countb++;
        }
        else if(counta>countb){
            counta++;
        }
        cout<<counta<<" "<<countb<<endl;
        counta=0;
        countb=0;
    }
    return 0;
}
void duce(){
    counta=0;countb=0;
        for(;j<str.size();j++){
            if(str[j]=='A'){
                counta++;
            }
            else{
                countb++;
            }
        }
        if(counta<countb){
            counta=10;countb=12;
        }
        else{
            counta=12;countb=10;
        }
    
    return;
}