// AOJ 0174
#include <iostream>
#include <string>

using namespace std;

int main()
{
	string str;
	while (1){
		cin >> str;
		if (str == "0") break;
		int kotori = 0, hanayo = 0;
		for (int i = 1; i < str.length(); i++){
			if (str[i] == 'A'){
				kotori++;
			}
			else hanayo++;
		}
		cin >> str;
		if (str[0] == 'A'){
			kotori++;
		}
		else hanayo++;
		cout << kotori << " " << hanayo << endl;

		kotori = 0, hanayo = 0;
		for (int i = 1; i < str.length(); i++){
			if (str[i] == 'A'){
				kotori++;
			}
			else hanayo++;
		}
		cin >> str;
		if (str[0] == 'A'){
			kotori++;
		}
		else hanayo++;
		cout << kotori << " " << hanayo << endl;

		kotori = 0, hanayo = 0;
		for (int i = 1; i < str.length(); i++){
			if (str[i] == 'A'){
				kotori++;
			}
			else hanayo++;
		}
		if (kotori < hanayo) hanayo++;
		else kotori++;
		cout << kotori << " " << hanayo << endl;
	}

	return 0;
}