#include <iostream>

using namespace std;

int main(){
  char c;
  string str;
  int cnt = 0;

  while(cin >> str , str != "0"){
    cnt++;
    if(cnt == 4) cnt = 1;

    int len = (int)str.size();
    int a = 0, b = 0;

    if(cnt != 1){
      if(c == 'B'){
	a++;
      }else{
	b++;
      }
    }else{
      a = 1;
    }

    for(int i = 1 ; i < len ; i++){
      if(str[i] == 'A'){
	a++;
      }else{
	b++;
      }
    }
    if(a == 10 && b == 1){
      cout << a+1 << " " << b-1 << endl;
    }else if(a == 1 && b == 10){
      cout << a-1 << " " << b+1  << endl;
    }else{
      cout << a << " " << b << endl;
    }
    c = str[len-1];
  }

  return 0;
}