#include <stdio.h>

#define MAX(x, y) ((x) > (y) ? (x) : (y))

int main(void)
{
	char game[3][256];
	int score[2];
	
	while (1){
		for (int i = 0; i < 3; i++){
			scanf("%s", game[i]);
			if (game[0][0] == '0') return (0);
		}
		
		for (int i = 0; i < 3; i++){
			score[0] = score[1] = 0;
			for (int j = 1; game[i][j] != '\0'; j++){
				if (game[i][j] == 'A'){
					score[0]++;
				}
				else {
					score[1]++;
				}
			}
			MAX(score[0], score[1])++;
			
			printf("%d %d\n", score[0], score[1]);
		}
	}
	
	return (0);
}