#include <iostream>
#include <string>

using namespace std;

int main()
{
	string inp[3];
	
	while (cin >> inp[0], inp[0] != "0")
	{
		cin >> inp[1] >> inp[2];

		for (int i = 0; i < 3; i++)
		{
			int a_ten = 0, b_ten = 0;

			for (int j = 0; j < inp[i].length(); j++)
			{
				if (j == 0) continue;
				if (inp[i][j] == 'A')
				{
					a_ten++;
				}
				else if (inp[i][j] == 'B')
				{
					b_ten++;
				}
			}

			if (a_ten > b_ten)
			{
				a_ten++;
			}
			else
			{
				b_ten++;
			}

			cout << a_ten << " " << b_ten << endl;
		}
	}
}