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

int main()
{
	string s;
	int a, b;

	cin >> s;

	while (s != "0") {
		a = 0;
		b = 0;

		for (int i = 1; i < (int)s.size(); i++) {
			if (s[i] == 'A')
				a++;
			else if (s[i] == 'B')
				b++;
		}
		if (a > b)
			a++;
		else if (a < b)
			b++;

		cout << a << " " << b << endl;
		cin >> s;
	}

	return 0;
}

