#include<cstdio>
#include<cstring>
#include<iostream>
#include<algorithm>
#include<map>
#include<string>
using namespace std;
int main(){
  string str;
  int l,a,b,i;  static int s;
  while(1){
  cin >> str;
  if(str[0]=='0')break;
  l=str.size();
  for(i=1,a=0,b=0;i<l;i++){
    if(str[i]=='A'){
      a++;
    }else{
      b++;
    }
  }
  if(a>b)a++;
  else if(b>a)b++;
  cout << a << " " << b << endl;
  }
}