#include<vector>
#include<list>
#include<algorithm>
#include<iostream>
#include<string>
#include<cstdio>
#include<cstdlib>
#include<cstring>
#include<cmath>
using namespace std;
int main(){
  int i;
  int len,a1,b1,a2,b2,a3,b3;
  string s;
  for(;;){
    s="";
    cin>>s;
    if(s=="0")
      break;
    len=s.length();
    a1=b1=a2=b2=a3=b3=0;
    for(i=1;i<len;i++){
      if(s[i]=='A')
	a1++;
      else
	b1++;
    }
    if(a1>b1)
      a1++;
    else
      b1++;
    cin>>s;
    len=s.length();
    for(i=1;i<len;i++){
      if(s[i]=='A')
	a2++;
      else
	b2++;
    }
    if(a2>b2)
      a2++;
    else
      b2++;
    cin>>s;
    len=s.length();
    for(i=1;i<len;i++){
      if(s[i]=='A')
	a3++;
      else
	b3++;
    }
    if(a3>b3)
      a3++;
    else
      b3++;
    cout<<a1<<" "<<b1<<endl;
    cout<<a2<<" "<<b2<<endl;
    cout<<a3<<" "<<b3<<endl;
  }
  return 0;
}