#include<iostream>
#include<string>
#include<vector>

using namespace std;

void solve(string s){
    int a[2] = {};
    for(int i = 1; i < s.size(); i++){
        a[s[i]-'A']++;
    }
    a[0]<a[1] ? a[1]++ : a[0]++;
    cout << a[0] << " " << a[1] << endl;

}


int main(){
    string s;
    while(cin >> s, s != "0"){
        solve(s);
        cin >> s;
        solve(s);
        cin >> s;
        solve(s);
    }
}

