#include<iostream>
using namespace std;

int main(){
    int a, b, i;
    while(1){
        a=0; b=0;
        char s[101]={'\0'};
        cin >> s;
        if(s[0]=='0') break;
        for(i=1; s[i]!='\0' && s[i]!= '\n';i++){
            if(s[i]=='A') a++;
            else if(s[i]=='B') b++;
        }
        if(a>b) a++;
        else if(a<b) b++;
        cout << a << " " << b << endl;
    }
    return 0;
}