#include <iostream>
#include <string>
#include <algorithm>
#include <functional>
#include <vector>
#include <utility>
#include <cstring>
#include <iomanip>
#include <numeric>
#include <cmath>
#include <cassert>
using namespace std;
using ll = long long;
const int INF = 1<<30;
const int MOD = 1e9 + 7;
signed main()
{
    cin.tie(0);
    ios::sync_with_stdio(false);
    string s;
    while(cin >> s)
    {
        if(s == "0") break;
        int a = 0, b = 0;
        for(int i = 1; i < s.size(); i++)
        {
            if(s[i] == 'A') a++;
            else b++;
        }
        if(a > b) a++;
        else b++;
        cout << a << " " << b << endl;
    }
    return 0;
}


