#include <iostream>

#define rep(i,n) for(int i=0;i<(int)(n);i++)

using namespace std;
typedef pair<string, int> P;
/** Problem0174 : Badminton **/
int main()
{
	int a, b;
	string s;
	while (cin>>s, s!="0") {
		a=0; b=0;
		s[0]='#';
		rep(i, s.length()) {
			if (s[i] == 'A') a++;
			else if (s[i] == 'B') b++;
		}
		if (a>b) a++;
		else b++;
		
		cout << a << " " << b << endl;
	}
	return 0;
}