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

int main(){
  int a,b;
  char tmp;

  while(1){
    tmp = getchar();
    if(tmp=='0')break;

    for(int i=0;i<3;i++){
      a = 0;
      b = 0;
      while(1){
	tmp = getchar();
	if(tmp=='\n')break;
	else if(tmp == 'A')a++;
	else b++;
      }
      if(i==2)break;
      tmp = getchar();;
      if(tmp == 'A')a++;
      else b++;
      cout << a << " " << b << endl;
    }
    if(a<10 && b==10)b++;
    else if(b<10 && a==10)a++;
    else if(a>b)a++;
    else b++;
    cout << a << " " << b << endl;
  }
}