#include <iostream>
#include <string>
int main(){
	int n[4]={0,0,0,0},i;
	std::string s;
	while (std::cin>>s){
		s=s.substr(s.find(",")+1);
		n[(s=="A")?0:(s=="B")?1:(s=="O")?3:2]++;
	}
	for (i=0;i<4;i++) std::cout<<n[i]<<"\n";
}