#include <iostream>
#include <string>

using namespace std;

void solve()
{
	string str;
	while(cin >> str, str != "0")
	{
		int pointA = 0;
		int pointB = 0;
		for(int i = 1; i < str.size(); ++i)
		{
			if(str[i] == 'A')
			{
				++pointA;
			}
			else
			{
				++pointB;
			}
		}
		if(pointA > pointB)
		{
			++pointA;
		}
		else
		{
			++pointB;
		}
		cout << pointA << " " << pointB << endl;
	}
}

int main()
{
	solve();
	return(0);
}