#include<stdio.h>
#include<string.h>

int main(void)
{
	int a,b,o,ab;
	int i;
	char s[5];
	a=b=o=ab=0;
	i=1;
	printf("%d,",i);
	while(scanf("%s",&s)!=EOF){

		if(strcmp(s,"A")==0)
			a++;
		else if(strcmp(s,"B")==0)
			b++;
		else if(strcmp(s,"O")==0)
			o++;
		else if(strcmp(s,"AB")==0)
			ab++;
		i++;
		printf("%d,",i);
	}
	printf("%d\n%d\n%d\n%d",a,b,ab,o);
	return 0;
}