#include <iostream>
using namespace std;

int main() {

  while (1) {

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

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

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

    }

    if (num_a > num_b) num_a++;
    else if (num_b > num_a) num_b++;

    cout << num_a << " " << num_b << endl;
  }

	return 0;
}