#include "bits/stdc++.h"
#include<unordered_map>
#include<unordered_set>
#pragma warning(disable:4996)
using namespace std;
using ld = long double;
template<class T>
using Table = vector<vector<T>>;
const ld eps=1e-9;

//// < "D:\D_Download\Visual Studio 2015\Projects\programing_contest_c++\Debug\a.txt" > "D:\D_Download\Visual Studio 2015\Projects\programing_contest_c++\Debug\b.answer"
int main() {
	while (1) {
		string st; cin >> st;
		if (st == "0")break;
		int a = 0, b = 0;
		for (int i = 1; i < st.size(); ++i) {
			if (st[i] == 'A') {
				a++;
			}
			else {
				b++;
			}
		}
		if (a > b)a++;
		else b++;
		cout << a << " " << b << endl;
	}
	return 0;
}