#include <iostream>
#include <algorithm>
#include <cassert>
#include <cctype>
#include <complex>
#include <cstdio>
#include <map>
#include <math.h>
#include <queue>
#include <set>
#include <stack>
#include <string>
#include <vector>
using namespace std;

char c;
string s;

int main(){
	while(cin>>s){
		if(s=="0")return 0;
		int h=3,f=0;
		while(h--){
			if(f)cin>>s;
			int cur=1,a=0,b=0;
			while(cur<s.size()){
				if(s[cur++]=='A')a++;
				else b++;
			}
			if(a>b)a++;
			else b++;
			cout<<a<<" "<<b<<endl;
			f=1;
		}
	}
}