#include <string>
#include <iostream>

#include <string.h>

using namespace std;

int main()
{
	const int DATASETS = 1000;

	int A[DATASETS], B[DATASETS], C = 0;

	string S[DATASETS];

	memset(A, 0, sizeof(A));
	memset(B, 0, sizeof(B));

	while (true)
	{
		cin >> S[C];

		if (S[C] == "0") { goto Exit; }

		for (string::size_type i = 0; i < S[C].size(); i++)
		{
			if (S[C][i] == 'A') { A[C]++; }
			if (S[C][i] == 'B') { B[C]++; }
		}

		C++;
	}

Exit:;

	for (int i = 0; i < C; i++)
	{
		cout << A[i] << ' ' << B[i] << endl;
	}

	return 0;
}