fork(6) download
  1. import Data.Functor -- <$> is not yet in the ideone prelude
  2. main = interact f
  3.  
  4. m f=map(f<$>)
  5. g=reverse.("":)
  6. f s|(f:c:s)<-m fromEnum.g.words$s,
  7. (f:c:s)<-init.unwords.g.m(\s->toEnum$if c!!0==s||s==sum(-32:c)then(last$f)else s)$s=init$s
Success #stdin #stdout 0s 4728KB
stdin
Programming Puzzles & Code Golf
stdout
rogramming Puzzles