if __FILE__ == $0
  bloods = []
  while line = gets
    num, c = line.rstrip.split(',')
    bloods += [c]
  end
  puts bloods.count("A")
  puts bloods.count("B")
  puts bloods.count("AB")
  puts bloods.count("O")
end