#include<iostream>
#include<cstring>
#include<algorithm>
#include<vector>
#include<cstdio>
#include<cmath>
#define pb(in,tmp) in.push_back(tmp)
#define loop(i,a,b) for(int i=a;i<b;i++)
#define rep(i,b) loop(i,0,b)
#define all(in) in.begin(),in.end()
using namespace std;
int main(){
char in[100]={0};
while(cin>>in,in[0]-'0'){
int a=0,b=0;
loop(i,1,strlen(in)){
if(in[i]=='A')a++;
if(in[i]=='B')b++;
}
if(a>b)cout<<a+1<<" "<<b<<endl;
else cout<<a<<" "<<b+1<<endl;
}
}