#include <iostream>
using namespace std;

int main() {

  int game_num = 0;

  while (1) {

    string in;
    cin >> in;
    if (in == "0") break;

    int num_a = 0, num_b = 0;
    for (int i = 0; i < in.size(); i++) {

      if (i == 0 && game_num != 0) {
        if (in[i+1] == 'A') {
          num_a++;
        }  else if (in[i+1] == 'B') {
          num_b++;
        }
        continue;
      }

      if (in[i] == 'A') {
        num_a++;
      }  else if (in[i] == 'B') {
        num_b++;
      }

    }

    if (num_a == 11 && num_b == 11) {
      if (in[in.size()-1] == 'A') {
        num_a++;
        num_b--;
      }  else if (in[in.size()-1] == 'B') {
        num_a--;
        num_b++;
      }
    }
    cout << num_a << " " << num_b << endl;
    game_num++;
    if (game_num == 3) game_num = 0;
  }

	return 0;
}