#include <iostream>
#include <cstring>
using namespace std;

int main()
{
	char serve[100];

	while (cin >> serve, serve[0] != '0'){
		int pt[2] = {0};
		for (int i = 0; i < strlen(serve) - 1; i++){
			if (serve[i] != serve[i + 1]){
				pt[serve[i + 1] - 'A']++;
			}
			else {
				pt[serve[i] - 'A']++;
			}
		}
		pt[serve[strlen(serve) - 1] - 'A']++; 
		cout << pt[0] << " " << pt[1] << endl;
	}

	return (0);
}