#include <iostream>
#include <cstdio>
#include <string.h>
using namespace std;
int main(void) {
  char ser[100];
  int serlen;
  int a=0, b=0;

  while(scanf("%s", ser) != 0) {
    serlen = strlen(ser);
    for(int i = 1 ; i < serlen ; i++) {
      if(ser[i] == 'A') a++;
      else if(ser[i] == 'B') b++;
      //cout << a << ' ' << b << endl;
    }
    if(a > b) a++;
    else if(b > a) b++;
    if(a == 0 && b == 0) break;
    cout << a << ' ' << b << endl;
    a = 0; b = 0;
  }
  return 0;
}