#include<iostream>
#include<cstdio>
#include<cstring>
#include<stdlib.h>
#define NN 1000
using namespace std;

int main(){
  char in[NN][NN];
  int k=0,i,j,a[NN],b[NN],l=0,an=0,bn=0,count=0;

  for(i=0;;i++){
    cin >> in[i];
    if(in[i][0] != 'A'  && in[i][0] != 'B')break;
    // cout << strlen(in[i]) << endl;    

    for(l=0;l<strlen(in[i]);l++){
      if(l>0){
	if(in[i][l] == 'A'){
	an++;
	}
	else if(in[i][l] == 'B'){
	  bn++;
	}
      }
    }
    /*
    cout << "**"<< an << " " << bn << endl;
    cout << "%%0 "<< a[0]<<" "<<b[0] <<endl;
    cout << "%%1 "<< a[1]<<" "<<b[1] <<endl;
    cout << "%%2 "<< a[2]<<" "<<b[2] <<endl;
    cout << "%%3 "<< a[3]<<" "<<b[3] <<endl;
    cout << "%%4 "<< a[4]<<" "<<b[4] <<endl;
    cout << "%%5 "<< a[5]<<" "<<b[5] <<endl;
    cout << "%%6 "<< a[6]<<" "<<b[6] <<endl;
    */ 

    if(an>=9&&bn>=9){
      if(an-1 == bn){
	a[k]=an+1;
	b[k]=bn;
	k++;
	an=0;
	bn=0;
	count++;
      }
      else if(an == bn-1){
	  a[k]=an;
	  b[k]=bn+1;
	  k++;
	  an=0;
	  bn=0;
	  count++;
	}
      }
    else if(an == 10){
      a[k]=an+1;
      b[k]=bn;
      k++;
      an=0;
      bn=0;
      count++;
    }
    else if(bn == 10){
      a[k]=an;
      b[k]=bn+1;
      k++;
      an=0;
      bn=0;
      count++;
    }  
    
    
    
    if(count == 3){
      for(j=0;j<3;j++){
	cout << a[j] << " " <<b[j] <<endl;
      }
      k=0;
      count=0;
    }
    
  }
  
  
  
}