#include<cstdio>
#include<iostream>
#include<algorithm>
#include<cstring>
#include<vector>
#define INF 999999
using namespace std;
int main(){
    char game[2000];
    while(cin>>game){
        int A=0,B=0;
        if(game[0]=='0')break;
        for(int i=1;i<strlen(game);i++){
            if(game[i]=='A')A++;
            else if(game[i]=='B')B++;
        }
        if(A>B)cout<<A+1<<" "<<B<<endl;
        else if(A<B)cout<<A<<" "<<B+1<<endl;
    }
    return 0;
}