#include <stdio.h>
#include <stack>
#include <math.h>

using namespace std;



int main(){

	int A_P,B_P;
	char buf[110];

	while(true){
		scanf("%s",buf);
		if(buf[0] == '0')break;

		A_P = B_P = 0;

		for(int i= 1;buf[i] != '\0'; i++){
			if(buf[i] == 'A'){
				A_P++;
				if(buf[i+1] == '\0'){
					if(A_P > B_P)A_P++;
					else{
						B_P++;
					}
				}
			}
			else{
				B_P++;
				if(buf[i+1] == '\0'){
					if(A_P > B_P)A_P++;
					else{
						B_P++;
					}
				}
			}
		}
		printf("%d %d\n",A_P,B_P);
	}
    return 0;
}