#include <iostream>
#include <string>
#include <sstream>
#include <algorithm>
#include <vector>
#include <utility>
#include <cstdio>
#include <cstring>
#include <cmath>
#include <map>
#include <set>
#include <stack>
#include <queue>
 
using namespace std;
 
#define pb(n)	push_back(n)
#define mp(n,m) make_pair(n,m)
#define fi 	first
#define se 	second
#define all(r) (r).begin(),(r).end()

#define rep(i,n) for(int i=0; i<(n); i++)
#define repc(i,a,b) for(int i=(a); i<(b); i++)

typedef long long ll;
typedef vector<int> vi;
typedef vector<ll> vl;
typedef pair<int,int> pii;
typedef pair<ll,ll> pll;
 
const int IMAX=((1<<30)-1)*2+1;
const double EPS=1e-10;
//int mod=1000000007




int main(){
	vector<string> s(3);
	while(cin>>s[0]){
		if(s[0]=="0")break;
		cin>>s[1]>>s[2];
		vector<pair<int,int> > v(3,pii(0,0));
		for(int i=0; i<3; i++){
			if(i>0){
				if(s[i][0]=='A')v[i-1].fi+=1;
				else v[i-1].se+=1;
			}
			for(int j=1; j<s[i].size(); j++){
				if(s[i][j]=='A')v[i].fi+=1;
				else v[i].se+=1;
			}
			if(i==2){
				if(v[i].fi>v[i].se)v[i].fi+=1;
				else v[i].se+=1;
			}
		}
		for(int i=0; i<3; i++){
			cout<<v[i].fi<<" "<<v[i].se<<endl;
		}
	}
}