#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;

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

  return 0;
}