#include<iostream>
#include<string>

int main(){

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

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

		a>b ? a++ : b++;
		std::cout << a << " " << b << std::endl;

	}

	return 0;
}