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

int main(){
  while(1){
    int point_a=0,point_b=0;
    string str;

    cin>>str;

    if(str[0]=='0')
      break;

    for(int i=1;i<str.size();i++){
      if(str[i]=='A')
        point_a++;
      else
        point_b++;
    }
    
    if(point_a>point_b)
      point_a++;
    else
      point_b++;
    
    cout<<point_a<<" "<<point_b<<endl;
  }

  return 0;
}

