#include <iostream>
#include <iomanip>
#include <vector>
#include <string>
#include <stack>
#include <queue>
#include <deque>
#include <set>
#include <map>
#include <algorithm>
#include <sstream>
#include <cstdlib>
#include <cstring>
#include <functional>
#include <numeric>
#include <cmath>
#include <climits>
#include <limits>
#include <cfloat>
#include <fstream>
using namespace std;

int main()
{
//	cut here before submit 
//	freopen("testcase.bm", "r", stdin);
	string str = "";

	while (getline (cin, str ) ){

		if (str.length() == 1 && str[0] == '0'){
			break;
		} // end if
		int i;
		int len = str.length();
		int scoreA = 0;
		int scoreB = 0;
		for (i = 1; i < len; ++i){
			if (str[i] == 'A'){
				++scoreA;
			}else{
				++scoreB;
			} // end if
		} // end for

		if (scoreA > scoreB ){
			++scoreA;
		}else if (scoreA < scoreB){
			++scoreB;
		} // end if

		cout << scoreA << ' ' << scoreB << endl;

	} // end loop

	return 0;
}