module Main where

count :: Eq a => a -> [a] -> Int
count _ [] = 0
count a (x:xs)
	| a == x = 1 + count a xs
	| otherwise = count a xs

summary :: [String] -> String
summary results = "AC x " ++ ac ++ "\nWA x " ++ wa ++ "\nTLE x " ++ tle ++ "\nRE x " ++ re
	where { ac = show $ count "AC" results ;
		wa = show $ count "WA" results ;
		tle = show $ count "TLE" results ;
		re = show $ count "RE" results }

main :: IO ()
main = interact $ summary . tail . lines
