#include<iostream>
#include<math.h>
#include<vector>
#include<algorithm>
#include<cstdio>
#include <string>
#include <complex>
#include <functional>
using namespace std;
typedef pair<int,int> P;

int main(){
    while(1){
        string s;
        cin>>s;
        if(s=="0") return 0;
        int n=s.size();
        int a=count(s.begin()+1,s.end(),'A');
        int b=n-a-1;
        if(a>b) ++a;
        else ++b;
        cout<<a<<' '<<b<<endl;
    }
    return 0;
}
