#include <iostream>
using namespace std;

int main(){


  int serve = 0;
    
  int sa=0,sb=0;


  while(1){
    string s;
    cin >> s;
    if(s == "0") break;
    int a=0,b=0;
    for(int i=1; i< s.size(); i++){
      if(s[i] == 'A')  a++,serve = 0;
      else if(s[i] == 'B')  b++,serve = 1;
    }
    if( a > b ) a++,sa++;
    if( b > a ) b++,sb++;
    
    cout << a << " " << b << "\n";
  }
    
  
}