#include <iostream>
#include <string>
using namespace std;

int main() {
    string s;
    while (true) {
        for (int i = 0; i < 3; i++) {
            cin >> s;
            if (s == "0") return 0;
            int a = 0, b = 0;
            for (int i = 1; i < s.length(); i++) {
                if (s[i] == 'A') a++;
                else b++;
            }
            if (a - b == 1) a = a+1;
            if (b - a == 1) b = b+1;
            if (a < 10) b = 11;
            if (b < 10) a = 11;
            cout << a << ' ' << b << endl;
        }
    }
    return 0;
}