#include <iostream>
using namespace std ;

int main(){
  string s;
  while(1){
    int pa = 0 ,pb = 0,i;
    cin >> s;
    if(s == "0")
      break;
    for(i=1;i<s.size();i++){
      if(s[i] == 'A'){
	pa++;
      } else {
	pb++;
      }
    }
    if(pa > pb){
      pa++;
    } else {
      pb++;
    }
    cout << pa << ' ' << pb << endl;
  }
  return 0;
}