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