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

int main(){
  int i,j,a,b;
  string str;
  while(1){
    getline(cin,str);
    if(str[0] == '0') break;

    a = 0;
    b = 0;
    for(i=1;i<str.size();i++){
      /*     if(a >= 11 && b < 10 || a >= 10 && b >= 10 && a-b >=2){
	  a++;
	  break;
	}
	else if(b >= 11 && a < 10 || a >= 10 && b >= 10 && b-a >=2){
	  b++;
	  break;
	  }*/
	 if(str[i] == 'A') a++;
	 else if(str[i] == 'B') b++;
	}

    if(a>b) a++;
    else b++;

      cout << a << " " << b << endl;

  }
  return 0;
}