#include <string>
#include <iostream>

using namespace std;

pair<int, int> solve(string S)
{
    int a = 0, b = 0;
    
    for(int i = 1; i < S.size(); i++)
    {
        if(S[i] == 'A')
        {
            a++;
        }
        else
        {
            b++;
        }
    }
    
    if(a == 10 && a > b) { a++; }
    else if(b == 10 && b < a) { b++; }
    else if(a > b) { a++; }
    else if(a < b) { b++; }
    
    return make_pair(a, b);
}

int main()
{
    while(true)
    {
        string S1, S2, S3;
        
        cin >> S1;
        
        if(S1 == "0") { break; }
        
        cin >> S2 >> S3;
        
        cout << solve(S1).first << ' ' << solve(S1).second << endl;
        cout << solve(S2).first << ' ' << solve(S2).second << endl;
        cout << solve(S3).first << ' ' << solve(S3).second << endl;
    }
    
    return 0;
}