import Data.List.Split (splitOn)
import Data.List (transpose)

stat :: [String] -> [Int]
stat ts = map howMany ["A", "B", "AB", "O"]
    where howMany t = length $ filter (== t) ts

main :: IO ()
main = putStr . unlines . map show . (\[_, l] -> stat l) . transpose . map (splitOn ",") . lines =<< getContents