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