# Volume0-0049
# Blood Groups
# http://judge.u-aizu.ac.jp/onlinejudge/description.jsp?id=0049

result = Array[ 0, 0, 0, 0 ]
while line = $stdin.gets
	data = line.chomp.split( "," )
	case data[ 1 ]
	when "A"
		result[ 0 ] += 1
	when "B"
		result[ 1 ] += 1
	when "AB"
		result[ 2 ] += 1
	when "O"
		result[ 3 ] += 1
	end
end
result.each{ |n|
	puts n
}
