#include <cstdio>
#include <cstdlib>
#include <cstring>
#include <cmath>
#include <ctime>
#include <iostream>
#include <algorithm>
#include <sstream>
#include <string>
#include <vector>
#include <queue>
#include <stack>
#include <map>
#include <set>
#include <utility>
using namespace std;

#define rep(i,n) for(int (i)=0; (i)<(int)(n); ++(i))
#define foreach(c,i) for(__typeof((c).begin()) i=(c).begin();i!=(c).end();i++)

int main() {
  string in;
  while (cin >> in) {
    if (in == "0") break;
    int i = 1, ct_a = 0, ct_b = 0;
    for (; i < in.size(); ++i) {
      in[i] == 'A' ? ct_a++ : ct_b++;
    }
    ct_a > ct_b ? ct_a++ : ct_b++;
    cout << ct_a << " " << ct_b << endl;
  }
  return 0;
}