#include<iostream>
#include<string>
#include<algorithm>
#include<vector>
#include<map>
#include<cstring>
using namespace std;

#define rep(i,n) for(int i=0;i<n;i++)
#define REP(n) rep(i,n)
#define all(n) n.begin(),n.end()

int main()
{
    string s[3];
    while(cin >> s[0])
    {
        if(s[0] == "0") return 0;
        cin >> s[1];
        cin >> s[2];

        int a[3] = {}, b[3] = {};

        int l;
        rep(j,3)
        {
            l = s[j].size();
            if(j>0)
            {
                if(s[j][0] == 'A')a[j-1]++;
                else b[j-1]++;
            }

            REP(l - 1)
                if(s[j][i + 1] == 'A') a[j]++;
                else b[j]++;
        }
        if(a[2] < b[2]) b[2]++; else a[2]++;

        REP(3)cout << a[i] << " " << b[i] << endl;
    }
    return 0;
}