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

int main()
{
    string s = "";

    while( cin >> s )
    {
        if( s == "0" )
            break;
        int a = 0, b = 0;
        for( int i = 0; i < s.size() - 1; i++ )
        {
            if( s[i+1] == 'A' )
                a++;
            else
                b++;
        }
        if( a > b )
            cout << ++a << " " << b << endl;
        else
            cout << a << " " << ++b << endl;
    }
    return 0;
}

