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

int main() {
	
	string a;
	int kazu,ten1,ten2;
	char sabu;
	int i;
	ten1=0;
	ten2=0;
	
	while(1){
		cin >> a;
		kazu=a.size();
		if(kazu==1) break;
		for(i=1;i<kazu+1;i++){
			sabu=a[i];
			if(sabu=='A') ten1++;
			if(sabu=='B') ten2++;
		}
		if(ten1<ten2) ten2++;
		if(ten1>ten2) ten1++;
		cout << ten1 << " " << ten2 << endl;
		ten1=0;
		ten2=0;
	}
	
	return 0;
}