#include<iostream>
using namespace std;

int main(){
 
 char servepoint[101];

 int Apoint,Bpoint;

 while(1){

   cin >> servepoint;
 
   if(servepoint[0] == '0') break;

   int i;

   i = 1;
 
   while(1){
       
       if(servepoint[i] =='\0') {

            if(Apoint >= 10 && Bpoint >= 10){

              if(servepoint[i-1]=='A') {Apoint++;}
          
              else Bpoint++;
             }

            else if(Apoint == 10 && Bpoint !=10) Apoint ++;
            else if(Bpoint == 10 && Apoint !=10) Bpoint ++;
  
           break;
       } 

       if(servepoint[i] == 'A') Apoint++;
     
       else if(servepoint[i] == 'B') Bpoint++;

      /* if(Apoint==10 && Bpoint !=10) break;
 
       else if (Apoint!=10 && Bpoint ==10) break;

       if(Apoint>=10&&Bpoint>=10){
     
          if(Apoint - Bpoint == 2 || Bpoint - Apoint == 2) break;
        } */
       
       i++;
    }

   

   cout << Apoint <<" "<< Bpoint <<endl;

   Apoint = 0; Bpoint = 0;

 }

 return 0;

}