#include<bits/stdc++.h>
using namespace std;
 
int main(){
    string s[20];
    int count = 0;
    while(true){
        cin >> s[count];
        if(s[count] == "0")break;
        count++;
    }
    for(int i = 0; i < count; i++){
        string r = s[i];
        int a = 0, b = 0;
        for(int j = 1; j < r.size(); j++){
            if(r[j] == 'A')a++;
            else if(r[j] == 'B') b++;
 
        }
        if(a > b)a++;
        else b++;
        cout << a << " " << b << endl;
    }
    return 0;
}
