fork(1) download
  1. import Data.Char
  2. main =
  3. mapM_ (putStrLn . checkPalindrome)
  4. [ "boo"
  5. , "A man, a plan, a cat, a ham, a yak, a yam, a hat, a canal-Panama!"
  6. , "A tin mug for a jar of gum, Nita."
  7. , "A Toyota! Race fast, safe car! A Toyota!"
  8. ]
  9. checkPalindrome s
  10. | (==) =<< reverse $ map toUpper $ filter isLetter s =
  11. show s ++ " is a palindrome."
  12. | otherwise = show s ++ " is NOT a palindrome."
  13.  
Success #stdin #stdout 0s 6276KB
stdin
Standard input is empty
stdout
"boo" is NOT a palindrome.
"A man, a plan, a cat, a ham, a yak, a yam, a hat, a canal-Panama!" is a palindrome.
"A tin mug for a jar of gum, Nita." is a palindrome.
"A Toyota! Race fast, safe car! A Toyota!" is a palindrome.