#include<iostream>
#include<string>
#include<vector>
#include<list>
#include<stdio.h>
#include<math.h>
#include<iomanip>
#define range(i,a,b) for(int i = (a); i < (b); i++)
#define rep(i,b) range(i,0,b)
#define debug(x) cout << "debug " << x << endl;
using namespace std;

int main(){
    string s;
    while(cin >> s, s[0] != '0'){
        int l = 0, r = 0;
        int i = 1;
        if(s[0] == '0') break;
        while(s[i]){
            if(s[i++] == 'A') l++;
            else r++;
        }
        if(l > r) l++;
        else r++;
        cout << l << ' ' << r << endl;
    }
}