#include<iostream>
#include<string>

int main()
{
	std::string s[3];
	while( std::cin >> s[0], s[0][0] - '0' )
	{
		for( int i = 1; i != 3; ++i )
			std::cin >> s[i];

		for( int i = 0; i != 3; ++i )
		{
			int pt[2] = { 0, 0 };
			
			for( int j = 1; j != s[i].size(); ++j )
				++pt[s[i][j]-'A'];

			if( i + 1 < 3 )
				++pt[s[i+1][0]-'A'];
			else
				++( pt[0] > pt[1] ? pt[0] : pt[1] );

			std::cout << pt[0] << ' ' << pt[1] << std::endl;
		}
	}

	return 0;
}