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

int main(){

	while(1){
		string str[3];
		int a[3] = {0}, b[3] = {0};

		cin>>str[0];
		if(str[0] == "0")
			break;

		cin>>str[1];
		cin>>str[2];

		for(int i=0;i<3;i++){
			for(int j=1;j<str[i].length();j++)
				if(str[i][j] == 'A')
					a[i]++;
				else if(str[i][j] == 'B')
					b[i]++;

			if(i != 2){
				if(str[i+1][0] == 'A')
					a[i]++;
				else if(str[i+1][0] == 'B')
					b[i]++;
			}else{
				if(a[i] > b[i])
					a[i]++;
				else
					b[i]++;
			}
		}

		for(int i=0;i<3;i++)
			cout<<a[i]<<" "<<b[i]<<endl;
	}

	return 0;
}