import Data.Char
import Data.List

main = interact $ unlines . show' . map length . group . sort . filter (not.null) . map (dropWhile (not.isUpper)) . lines
 where show' [a,ab,b,o] = map show [a,b,ab,o]