#include <iostream>
using namespace std;

int main() {
    while (true) {
        char serve[101] = {};
        cin >> serve;
        if (serve[0] == '0') {
            break;
        }
        int score[2] = {};
        for (int i = 1; serve[i] != '\0'; i++) {
            if (serve[i] == 'A') {
                score[0]++;
            } else {
                score[1]++;
            }
        }
        if (score[0] > score[1]) {
            score[0]++;
        } else {
            score[1]++;
        }
        cout << score[0] << " " << score[1] << endl;
    }
}