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

int main(){
  int n,num,ap,bp;
  string str;
  while(1){
    ap =bp =0;
    getline(cin,str);
    if(str[0] == '0') return 0;
    for(int i = 1;i < str.length(); i++){
      if(str[i] == 'A')
	ap++;
      else 
	bp++;
    }
    if(ap > bp)
      ap++;
    else 
      bp++;
    cout << ap << " " << bp <<endl;
  }
  return 0;
}