#include <iostream>
#include <string>
using namespace std;

int main() {
  string record;
  int a_score, b_score;

  while(1) {
    a_score = 0;
    b_score = 0;
    cin >> record;
    if(record == "0") break; 
    
    for(int i = 1; i < 10; i++) {
      if(record[i] == 'A')
	a_score += 1;
      else
	b_score += 1;
    }
    for(int i = 10; i < record.length(); i++) {
      if(record[i] == 'A')
	a_score += 1;
      else
	b_score += 1;
      }
    if(a_score > b_score)
      cout << a_score+1 << ' ' << b_score << endl;
    else
      cout << a_score << ' ' << b_score+1 << endl;
  }
  return 0;
}
