#include<bits/stdc++.h>

using namespace std;

int main(){

  string record;
  
  while(1){

	int a=0;
	int b=0;
	
	cin>>record;

	if(record == "0")
	  break;

	bool flag = false; 
	
	for(int i=0;i<record.size()-1;++i){
	  if(record[i] == record[i+1] && record[i] == 'A')
		a++;
	  else if(record[i] == record[i+1] && record[i] == 'B')
		b++;
	  else if(record[i] != record[i+1] && record[i] == 'A')
		b++;
	  else if(record[i] != record[i+1] && record[i] == 'B')
		a++;

	  if(flag == false && (a == 11 || b == 11))
		break;

	  if(flag == true && (a-b == 2 || b-a == 2))
		break;
	  
	  if(a == 10 & b == 10)
		flag =true;

	}

	if(a > b) a++;
	else b++;
	
	cout<<a<<" "<<b<<endl;
	
  }
  
}

