#include<cstdio>
int main(){
  char c[105];
  int a,b;
  while(scanf("%s",c),c[0]!='0'){
    a=0;
    b=0;
    for(int i=1;c[i]!='\0';i++){
      if(c[i] == 'A') a++;
      if(c[i] == 'B') b++;
    }
    if(a > b) a++;
    if(b > a) b++;
    printf("%d %d\n",a,b);
  }
  return(0);
}

