#include <iostream>
#include <string>
using namespace std;

int main() {
	int a, b;
	string s;
	while (1) {
		for (int i = 0; i < 3; i++) {
			a = 0;
			b = 0;
			getline(cin, s);
			if (s == "0") return 0;
			for (int j = 1; j < s.size(); j++) {
				if (s[j] == 'A') a++; else b++;
			}
			if (a > b) a++; else b++;
			cout << a << " " << b << endl;
		}
	}
	return 0;
}