blood_count = {"A"=>0, "B"=>0, "AB"=>0, "O"=>0}

while input_data = gets
  blood_type = input_data.chomp.split(',')
  blood_count[blood_type[1]] += 1
end

blood_types = ["A", "B", "AB", "O"]
blood_types.each { |blood|
  puts blood_count[blood]
}