import List m@main=getLine>>=putStrLn.(>>=show).tail.reverse.sort.map length.group.sort>>m