#include <iostream>
#include <string>

using namespace std;

int main(void){
	string str;

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