fork download
  1. import Data.Char
  2. import Data.List
  3. import Control.Monad
  4.  
  5. beauty = dot [26,25..1] . sortBy (flip compare) . map length . group . sort . map toLower . filter isAlpha
  6. where dot = sum .^ zipWith (*)
  7. (.^) = (.) . (.)
  8.  
  9. main = forever $ getLine >>= (print . beauty)
  10.  
Runtime error #stdin #stdout #stderr 0s 5748KB
stdin
ABbCcc
Good luck in the Facebook Hacker Cup this year!
Ignore punctuation, please :)
Sometimes test cases are hard to make up.
So I just go consult Professor Dalves
stdout
152
754
491
729
646
stderr
prog: <stdin>: hGetLine: end of file