#include <iostream>
#include <cstdio>
#include <vector>
#include <algorithm>
#include <complex>
#include <cstring>
#include <cstdlib>
#include <string>
#include <cmath>
#include <queue>
using namespace std;

#define REP(i,n) for(int i=0;i<(int)n;++i)
#define FOR(i,c) for(__typeof((c).begin())i=(c).begin();i!=(c).end();++i)
#define ALL(c) (c).begin(), (c).end()
#define INF 1<<30

int main() {
  bool f = true;
  while(f) {
    string s;
    int hoge = 0;
    REP(i,3) {
      cin >> s;
      if (s == "0") {
        f = false;
        break;
      }
      int a = count(ALL(s),'A');
      int b = count(ALL(s),'B');
      if (hoge == 0)
        a--;
      else
        b--;
      if (a>b) {
        a++;
        hoge = 0;
      } else {
        b++;
        hoge = 1;
      }
      cout << a << " " << b << endl;
    }
  }
}