#include <iostream>
#include <string>
using namespace std;

int main(){
	string s;
	int a,b;
	while(getline(cin,s)){
		if(s == "0") break;
		a = b = 0;
		for(int i = 1;i <= s.length();++i){
			if(s[i] == 'A') ++a;
			else ++b;
		}
		cout << a << " " << b << endl;
	}
	return 0;
}