type blood = {mutable a: int; mutable b: int; mutable ab: int; mutable o: int}

let count br bs =
  if bs = "A" then br.a <- br.a + 1
  else if bs = "B" then br.b <- br.b + 1
  else if bs = "AB" then br.ab <- br.ab + 1
  else br.o <- br.o + 1

let _ =
  let c = {a=0; b=0; ab=0; o=0} in
  try
    while true do
      let bt = Scanf.scanf "%d,%s\n" (fun x y -> y) in
      count c bt
    done
  with
    End_of_file -> Printf.printf "%d\n%d\n%d\n%d\n" c.a c.b c.ab c.o