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

int main(){
  string s;
  while(std::cin >> s, s != "0"){
    int a = 0, b = 0;
    for (int i = 1; i < s.length(); i++) {
      if(s[i] == 'A')a++;
      else b++;
    }
    if(a - b >= 1)a++;
    else b++;
    std::cout << a << " " << b << std::endl;
  }
  return 0;
}