#include<iostream>
#include<string>

int main(){

	std::string all, str;
	while (std::cin >> str){
		if (str == "0")break;
		all += str;
	}


	int a = 0, b = 0;
	for (int i = 0; i < all.size() - 1; i++){
		if (all[i + 1] == 'A')a++;
		else b++;

		if (a == 10 || b == 10){
			if (a == 12 || b == 12){
				std::cout << a << " " << b << std::endl;
				a = 0, b = 0;
			}
		}

		else if (a == 11 || b == 11){
			std::cout << a << " " << b << std::endl;
			a = 0, b = 0;
		}

	}

	a > b ? a++ : b++;

	std::cout << a << " " << b << std::endl;

	return 0;
}