#include <iostream>
using namespace std;

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