#include <iostream>
#include <string>
using namespace std;
int main(void){
    
    string game;
    
    while(cin >> game, game != "0"){
        int A = 0, B = 0;
        for(int i = 1; i <= game.size(); i++){
            if(game[i] == 'A') A++;
            else if(game[i] == 'B') B++;
        }
        
        if(A>B)A++;
        else B++;
        
        cout << A << " " << B << endl;
    }
}
