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

int main(){
 
 string servepoint;

 int Apoint,Bpoint;

 while(1){

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

   int i;

   i = 1;
 
   Apoint = 0; Bpoint = 0;

   for(int i=1; i < servepoint.size();i++){

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

  if(Apoint > Bpoint) Apoint++;
      
  else Bpoint++;

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

 }

 return 0;

}