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

while line = gets
  data = line.chomp.split(",")
  count[data[1]] += 1
end

puts count["A"]
puts count["B"]
puts count["AB"]
puts count["O"]