#include <bits/stdc++.h>
using namespace std;

typedef long long ll;
typedef pair<int, int> P;

#define pb push_back
#define rep(i, a, n) for(int i = (a); i < (n); i++)
#define dep(i, a, n) for(int i = (a); i >= (n); i--)
#define mod 1e9+7

__attribute__((constructor))
void initial() {
  cin.tie(0);
  ios::sync_with_stdio(false);
}

int main() {
  string s;
  while(cin >> s) {
    if(s == "0") return 0;

    int a = 0, b = 0;
    rep(i, 1, s.length()) {
      if(s[i] == 'A') a++;
      else b++;
    }

    cout << (a == max(a, b) ? a + 1 : a) << " " << (b == max(a, b) ? b + 1 : b) << endl;
  }
}