#include <bits/stdc++.h>

#define ALL(a) (a).begin(), (a).end()
#define llong long long

using namespace std;

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


