#include<iostream>
#include<string>

using namespace std;

int main(){
  int i, j, Awin[3], Bwin[3];
  string game;

  while(1){
    for(i=0; i<3; ++i){
      cin >> game;
      if(game == "0") break;

      Awin[i] = 0;
      Bwin[i] = 0;
      for(j=1; j<game.size(); ++j){
	if(game[j] == 'A')
	  ++Awin[i];
	else
	  ++Bwin[i];
      }
      if(game[game.size()-1] == 'A')
	++Awin[i];
      else
	++Bwin[i];
    }

    if(game == "0") break;
    for(i=0; i<3; ++i)
      cout << Awin[i] << " " << Bwin[i] << endl;
  }

  return 0;
}