#include<iostream>
#include<string>
using namespace std;
char winer;
int main(){
	string s;
	while(cin >> s){
		if(s == "0") break;
		int scoreA=0, scoreB=0;

		for(string::size_type i=1; i<s.size(); i++){
			if(s[i] == 'A') scoreA++;
			if(s[i] == 'B') scoreB++;
		}
		if(scoreA > scoreB)
			cout << scoreA+1 << " " << scoreB << endl;
		else
			cout << scoreA << " " << scoreB+1 << endl;
	}
	return 0;
}