#include<iostream>
#include<string>
using namespace std;

int main() {

  string s;
  while(true) {

    cin>>s;
    if( s == "0" ) break;

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

    ( a > b ) ? a++ : b++;

    cout<<a<<" "<<b<<endl;
  }
}