object Main extends App {
  val src = io.Source.stdin.getLines.toList.flatMap(_.split(",")).filter { x => ('A' to 'Z').exists(_ == x.head) }

 List("A", "B", "AB", "O").map { t => src.count(_ == t) }.foreach(println)
}