arr = Array.new(4, 0)

while line = gets
  a, b = line.chomp.split(",")
  case b
  when "A"
    arr[0] += 1
  when "B"
    arr[1] += 1
  when "AB"
    arr[2] += 1
  when "O"
    arr[3] += 1
  end
end

puts arr