//28
#include<iostream>

using namespace std;

int main(){
  for(;;){
    for(int i=0;i<3;i++){
      char s[101];
      int scr[2]={};
      cin>>s;
      if(s[0]=='0')return 0;
      for(int j=1;s[j];j++){
	scr[s[j]-'A']++;
      }
      (*((scr[0]>scr[1])?scr:scr+1))++;
      cout<<scr[0]<<' '<<scr[1]<<endl;
    }
  }
  return 0;
}
    