#include <iostream>
#include <algorithm>
#include <math.h>

using namespace std;
bool isPrime(int num);

int main(){
	string data;
	while(cin >> data, data != "0"){
		int a = 0, b = 0;
		for(int i = 1; i <= data.size(); i++){
			if(data[i] == 'A'){
				a++;
			}else if(data[i] == 'B'){
				b++;
			}
		}
		
		if(a > b) a++;
		if(a < b) b++;
		
		cout << a << " " << b << endl;
	}
	return 0;
}
