#include<iostream>
#include<string.h>

using namespace std;

int main(){

  char record[101];
  int count;
  int play_a;
  int play_b;
  int n;

  while(cin >> record){
    
    if(record[0]=='0')
      break;

    n = strlen(record);
      
    count=0;
    play_a=0;
    play_b=0;
    
    for(int i=1; i<n; i++){
      if(record[i]=='A'){
	play_a++;
      } else {
	play_b++;
      }
    }
    
    if(play_a>play_b){
      play_a++;
    } else {
      play_b++;
    }
    
    cout << play_a << " " << play_b << endl;
  }
}
