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

int main(){
	char game[101];
	cin>>game;
	int m;int n;
	while(game[0]!='0'){
		m=0;n=0;
		for(int i=1;game[i]!='\0';i++){
			if(game[i]=='A'){
				 m++;
			}
			else if(game[i]=='B'){
				n++;
			}
		}
		if(m>n){
			cout<<m+1<<' '<<n<<endl;
		}
		else if(m<n){
			cout<<m<<' '<<n+1<<endl;
		}
		cin>>game;
	}

	return 0;
}