#include <iostream>
using namespace std;
int main(){
  int flag,a,b;
  char s[101];
  while(1){
    flag = 0;
    a = 0;
    b = 0;
    cin >> s;
    if(s[0] == '0'){
      break;
    }
    for(int i=1;s[i]!='\0';i++){
      if(s[i] == 'A'){
	a++;
      }
      else if(s[i] == 'B'){
	b++;
      }
    }
    if(a < b){
      b++;
    }
    else if(a > b){
      a++;
    }
    cout << a << " " << b << endl;
  }
}