
#include<iostream>
#include<stdio.h>
using namespace std;




main(){

  char ab[13][102];
  
  int i=0,j=0;
  int sumA[13],sumB[13], game=0;
  
  for(i=0;i<13;i++){
    sumA[i]=0;
    sumB[i]=0;
    
  }
  i=0;
  j=0;

  while(1){
    
    scanf("%c",&ab[i][j]);
    
    if( ab[i][j]== '0'){
      break;
    }
    
    //Ã£ÂÂÃ£ÂÂÃ£ÂÂÃ£ÂÂ¯Ã§ÂÂ¨
    // cout << ab[i][j] <<" "<< i <<" " <<j<< " "<< sumA[i]<< " " << sumB[i]<< endl;
     //cout << game <<  " " << i<< endl;
    
    if(ab[i][j]=='A' && j!=0)sumA[i]++;
    if(ab[i][j]=='B' && j!=0)sumB[i]++;
    
    j++;
    
    
    
    if(ab[i][j-1]== '\n' || ab[i][j-1]=='\0'){
      i++;
      j=0;
      game++;
      //cout << "OK";
    }
    
    
    /*
    if(ab[i][j-1] != 'A' && ab[i][j-1]!= 'B'){
      i++;
      j=0;
      game++;
    }
    */
  }
  
  
  for(i=0;i<game;i++){

    //AÃ£ÂÂBÃ£ÂÂÃ£ÂÂÃ£ÂÂ§Ã£ÂÂÃ£ÂÂÃ¦ÂÂ
    if(sumA[i]>sumB[i]){
      if(sumB[i]>=10){
	sumA[i] = sumB[i]+2;
      }
      if(sumB[i]<10){
	sumA[i] += 11 - sumA[i];
      }
    }
    
    //BÃ¯Â¼ÂAÃ£ÂÂ®Ã¦ÂÂ
    if(sumB[i]>sumA[i]){
      if(sumA[i]>=10){
	sumB[i] = sumA[i]+2;
      }
      if(sumA[i]<10){
	sumB[i] += 11 - sumB[i];
      }
    }
    
  }
  
  for(i=0;i<game;i++){
    
    cout << sumA[i]<< " " << sumB[i]<< endl;

  }
  


  return 0;

}