#include<iostream>
#include<stdio.h>

using namespace std;

int main(){

  int a=0, b=0;
  char in;
  int i = 0;

  while(scanf("%c",&in)){
    if(in == '0') break;
    if(i == 0){
      scanf("%c",&in);
      i++;
    }
    if(in == 'A') a++;
    if(in == 'B') b++;
    if(in == '\n'){
      i = 0;
      if(a > b) a++;
      else b++;
      cout << a << " " << b << endl;
      a = 0;
      b = 0;
    }

  }
  return 0;

}