#include<iostream>
#include<string>
#include<algorithm>
using namespace std;
int main(){
	string save;
	int A = 0, B = 0;
	while (1){
		cin >> save;
		int s = save.size();
		if (save[0] == '0') break;
		for (int i = 1; i < s; i++){
			if (save[i] == 'A') A++;
			else B++;

		}
		if (A > B) A++;
		else B++;
		cout << A << ' ' << B << endl;
		A = B = 0;
	}
	return 0;
}