#include <iostream>
#include <sstream>
#include <iomanip>
#include <algorithm>
#include <cmath>
#include <string>
#include <vector>
#include <list>
#include <queue>
#include <stack>
#include <set>
#include <map>
#include <bitset>
#include <numeric>
#include <climits>
#include <cfloat>
using namespace std;

int main()
{
    for(;;){
        string s;
        cin >> s;
        if(s == "0")
            return 0;

        int n = s.size();
        int a = count(s.begin()+1, s.end(), 'A');
        int b = n - a - 1;
        if(a > b)
            ++ a;
        else
            ++ b;

        cout << a << ' ' << b << endl;
    }
}