import scala.io.Source.stdin

object Main extends App {
  val m = new Array[Int](4)
  stdin.getLines.map(_.split(",")).foreach { x =>
    x(1) match {
      case "A" => m(0) += 1
      case "B" => m(1) += 1
      case "AB" => m(2) += 1
      case "O" => m(3) += 1
    }
  }
  for(i<-0 to 3)
    println(m(i))
}