#include<iostream>
#include<string>
#include<algorithm>	
#include<cmath>
#include<map>
#include<vector>
#define int long long
using namespace std;
int test[51];
signed main() {
    int n; string s;
    for (int h = 0; h < 20; h++) {
        cin >> s; int a = 0, b = 0;
        if (s == "0") { return 0; }
        for (int h = 1; h < s.size(); h++) {
            if (s[h] == 'A') { a++; }
            if (s[h] == 'B') { b++; }
        }
        if (a > b) { cout << a + 1 << ' ' << b << endl; }
        else {
            cout << a << ' ' << b + 1 << endl;
        }
    }
}
