#include <bits/stdc++.h>

using namespace std;
using ll = long long;
using pii = pair<int, int>;

int main() {
  cin.tie(0);
  ios_base::sync_with_stdio(false);
  cout << fixed << setprecision(10);
  
  string s;
  while (cin >> s, s != "0") {
    int a = 0, b = 0;
    for (int i = 1; i < int(s.size()); i++) {
      if (s[i] == 'A') a++;
      else b++;
    }
    if (a > b) cout << a + 1 << " " << b << endl;
    else cout << a << " " << b + 1 << endl;
  }

  return 0;
}
