#include <cstdio>
#include <cstring>
#include <algorithm>
#include <string>
#include <cmath>
#include <stack>
#include <vector>
#include <map>
#include <set>
#include <queue>
#include <list>
#include <iostream>
#include <sstream>
#include <climits>
#include <cfloat>
#include <complex>

using namespace std;

int main()
{
	char buf[3][128];
	while (cin.getline(*buf, sizeof(*buf)), **buf != '0')
	{
		cin.getline(buf[1], sizeof(*buf));
		cin.getline(buf[2], sizeof(*buf));

		int a[3], b[3];
		for (int i = 0; i < 3; ++i)
		{
			a[i] = b[i] = 0;
			for (int j = 1; buf[i][j] != '\0'; ++j)
				if (buf[i][j] == 'A')
					++a[i];
				else
					++b[i];
			if (i < 2)
				if (buf[i+1][0] == 'A')
					++a[i];
				else
					++b[i];
		}
		if (a[2] > b[2])
			++a[2];
		else
			++b[2];
		for (int i = 0; i < 3; ++i)
			printf("%d %d\n", a[i], b[i]);
	}

	return 0;
}