#include <iostream>
#include <string>
using namespace std;
string s;
main()
{
    while( 1 )
    {
        cin >> s;
        if( s == "0" ) break;
        int n = s.size();
        int a = 0, b = 0;
        for( int i = 0; i < n - 1; i++ )
        {
            if( s[i]  == 'A')
            {
                if( s[i + 1] == 'A' )a++;
                else b++;
            }
            else if( s[i] == 'B' )
            {
                if( s[i + 1] == 'A' )a++;
                else b++;
            }
        }
        if( a > b ) a++;
        else b++;
        printf( "%d %d\n", a, b );
    }
    return 0;
}
