#include <map>
#include <set>
#include <list>
#include <cmath>
#include <queue>
#include <stack>
#include <cstdio>
#include <string>
#include <vector>
#include <complex>
#include <cstdlib>
#include <cstring>
#include <numeric>
#include <sstream>
#include <iostream>
#include <algorithm>
#include <functional>

#define mp       make_pair
#define pb       push_back
#define all(x)   (x).begin(),(x).end()
#define rep(i,n) for(int i=0;i<(n);i++)
#define repi(i,a,b) for(int i = (a); i < (b); i++)

using namespace std;

typedef    long long          ll;
typedef    unsigned long long ull;
typedef    vector<bool>       vb;
typedef    vector<int>        vi;
typedef    vector<vb>         vvb;
typedef    vector<vi>         vvi;
typedef    pair<int,int>      pii;

const int INF=1<<29;
const double EPS=1e-9;

const int dx[]={1,0,-1,0},dy[]={0,-1,0,1};

string str;
int main(){
	while(cin>>str){
		if(str=="0")break;
		int a,b;
		a=b = 0;
		for(int i =1;i <str.length();i++){
			if(str[i]=='A'){
				a++;
			}else{
				b++;
			}
			if(i==str.length()-1){
				if(a>b){
					a++;
				}else{
					b++;
				}
			}
		}
		cout <<a<<" "<<b<<endl;
		for(int i = 0;i <2;i++){
			cin>>str;
			a = b = 0;
			for(int j = 1;j <str.length();j++){
				if(str[j]=='A'){
					a++;
				}else{
					b++;
				}
				if(j==str.length()-1){
					if(a>b){
						a++;
					}else{
						b++;
					}
				}
			}
			cout <<a<<" "<<b<<endl;
		}

	}
	return 0;
}