#include <iostream>
#include <sstream>
#include <string>
#include <vector>
#include <set>
#include <map>
#include <stack>
#include <queue>
#include <algorithm>
#include <numeric>
#include <functional>
#include <cstdio>
#include <cstdlib>
#include <cstring>
#include <cmath>
#include <climits>
using namespace std;

typedef istringstream ISS;
typedef ostringstream OSS;
typedef vector<string> VS;
typedef int INT;
typedef vector<INT> VI;
typedef vector<VI> VVI;
typedef pair <INT, INT> II;
typedef vector <II> VII;

template<class T> ostream& operator << ( ostream& os, vector<T> v ) {
    for ( typename vector<T>::iterator it_i = v.begin(); it_i != v.end(); ++it_i ) {
        os << *it_i << ", ";
    }
    return os;
}


void solve( string s0, string s1, string s2 ) {
    int A0 = 0, A1 = 0, A2 = 0;
    int B0 = 0, B1 = 0, B2 = 0;
    int n0 = s0.size(), n1 = s1.size(), n2 = s2.size();
    for ( int i = 1; i < n0; ++ i ) {
        if ( s0[i] == 'A' ) A0 ++;
        else B0 ++;
    }
    for ( int i = 1; i < n1; ++ i ) {
        if ( s1[i] == 'A' ) A1 ++;
        else B1 ++;
    }
    for ( int i = 1; i < n2; ++ i ) {
        if ( s2[i] == 'A' ) A2 ++;
        else B2 ++;
    }
    if ( s1[0] == 'A' ) A0 ++;
    else B0 ++;
    if ( s2[0] == 'A' ) A1 ++;
    else B1 ++;
    if ( A2 >= 10 && B2 >= 10 ) {
        if ( A2 > B2 ) A2 ++;
        else B2 ++;
    } else if ( A2 > B2 ) {
        A2 ++;
    } else {
        B2 ++;
    }

    cout << A0 << " " << B0 << endl;
    cout << A1 << " " << B1 << endl;
    cout << A2 << " " << B2 << endl;
}

int main() {
    string s0, s1, s2;
    while ( cin >> s0 ) {
        if ( s0 == "0" ) break;
        cin >> s1 >> s2;
        solve( s0, s1, s2 );
    }
    return 0;
}