#include <iostream>

using namespace std;

int main()
{
    string inp;

    while (cin >> inp, inp != "0") {
        int a, b;

        a = b = 0;
        for (int i = 1; i < inp.size(); i++) 
            inp[i] == 'A' ? a++ : b++;

        (a > b) ? a++ : b++;
        cout << a << " " << b << endl;
    }

    return 0;
}