import           Control.Applicative

count :: [String] -> (Int, Int, Int, Int)
count [] = (0, 0, 0, 0)
count (x:xs)
    | x == "AC" = (ac+1, wa, tle, re)
    | x == "WA" = (ac, wa+1, tle, re)
    | x == "TLE" = (ac, wa, tle+1, re)
    | x == "RE" = (ac, wa, tle, re+1)
    | otherwise = (ac, wa, tle, re)
  where
      (ac, wa, tle, re) = count xs

main :: IO ()
main = do
    input <- count . lines <$> getContents
    sequence_ . map putStrLn . getZipList $
        (++) <$> ZipList ["AC x ", "WA x ", "TLE x ", "RE x "]
             <*> ZipList ((\(w, x, y, z) -> map show [w, x, y, z]) input)
