#include <iostream>
#include <string>
#include <algorithm>
using namespace std;

void f(const string& s,int& a, int& b){
	a = count( s.begin() , s.end() , 'A' );
	b = count( s.begin() , s.end() , 'B' );
}

int main(){
	string s;
	while( cin >> s , s != "0" ){
		int a,b;
		f(s,a,b);
		a--;
		(a>b)? a++ : b++ ;
		cout << a << " " << b << endl;
		for(int i=0 ; i < 2 ; i++ ){
			cin >> s;
			f(s,a,b);
			(s[0]=='A')? a-- : b-- ;
			(a>b)? a++ : b++ ;
			cout << a << " " << b << endl;
		}
	}
}