#include<iostream>
#include<cstring>
using namespace std;
int main(){
  int as,bs;
  char s[101],sf;
  cin >> sf;
  while(cin>>s){
    if(s[0]=='0') break;
    as = 0;
    bs = 0;
    for(int i=1;i<strlen(s);i++){
      if(s[i]=='A') as++;
      else bs++;
    }
    if(as>bs) as++;
    else bs++;
    cout << as << ' ' << bs << endl;
  }
  return 0;
}