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

int main()
{
	string s;
	while( cin >> s && s != "0" ){
		int point[ 'Z' ] = { 0 };
		for( int i = 1; i < (int)s.size(); ++i ){
			++point[ s[ i ] ];
		}
		point[ 'A' ] > point[ 'B' ] ? ++point[ 'A' ] : ++point[ 'B' ];
		cout << point[ 'A' ] << " " << point[ 'B' ] << endl;
	}

	return 0;
}