#include <iostream>
#include <vector>
#include <algorithm>
using namespace std;
#define rep(i,n) for(int i=0;i<n;i++)

int main(){
	string s[3];
	while(cin >> s[0] , s[0] != "0"){
		cin >> s[1] >> s[2];
		rep(j,3){
			int a[2] ={0};
			rep(i,s[j].size()-1){
				a[s[j][i+1]!='A']++;
			}
			cout << a[0] + (a[0]>a[1]) << " " << a[1] + (a[1]>a[0]) << endl;
		}
	}
}