#include<iostream>
#include<string>
using namespace std;

int main(){
	string save;
	while(1){
		cin >> save;
		if(save == "0") break;
		int len = save.size();
		int ac=0,bc=0;
		for(int i=1;i<len;i++){
			if(save[i] == 'A') ac++;
			else bc++;
		}
		if(ac > bc) ac++;
		else bc++;
		cout << ac << " " << bc << endl;
	}
}