#include <bits/stdc++.h>

using namespace std;


int main() {
	int len,sumA,sumB;
	string r;

	while (1) {
		cin >> r;
		len = r.size();
		if (len == 1) {
			break;
		}

		sumA = sumB = 0;
		for (int index = 1; index < len; index++) {
			if (r[index] == 'A') {
				sumA++;
			}
			else {
				sumB++;
			}
		}

		if (sumA > sumB) {
			sumA++;
		}
		else {
			sumB++;
		}
		cout << sumA << " " << sumB << endl;
	}

	return 0;
}
