#include <cstdio>
#include <cstring>

using namespace std;

int main()
{
	char score[101];
	int cnt_a = 0, cnt_b = 0;
	int len;
	
	while (1){
		scanf("%s", score);
		
		if (score[0] == '0'){
			break;
		}
		
		len = strlen(score);
		
		for (int i = 0; i < len; i++){
			if (score[i] == 'A'){
				cnt_a++;
			}
			else if (score[i] == 'B'){
				cnt_b++;
			}
		}
		
		if (cnt_a == 1){
			cnt_a--;
		}
		else if (cnt_b == 1){
			cnt_b--;
		}
		
		printf("%d %d\n", cnt_a, cnt_b);
	}
	
	return (0);
}