#include <iostream>

int main()
{
	std::string input;
	while (true) {
		getline(std::cin, input);
		if (input == "0") break;
		int a=0, b=0;
		for (int i=1; i<input.length(); i++) {
			if (input[i] == 'A') a++;
			else b++;
		}
		if (a>b) a++;
		else b++;
		std::cout << a << " " << b << std::endl;
	}
	return 0;
}

