#include <iostream>
#include <string>
using namespace std;
#define rep2(x,from,to) for(int x=(from);x<(to);++(x))
#define rep(x,to) rep2(x,0,to)
int main(){
	string s[3];
	while(1) {
		cin >> s[0];
		if(s[0] == "0") break;
		rep2(i,1,3) {
			cin >> s[i];
		}
		rep(i,3) {
			int a = 0, b = 0;
			rep2(j,1,s[i].size()) {
				if(s[i][j] == 'A') a++;
				else b++;
			}
			if(a>b) a++;
			else b++;
			cout << a << " " << b << endl;
		}
	}
   return 0;
}