fork(1) download
  1. import Data.Char
  2.  
  3. main = print $ rot13 "How can you tell an extrovert from an"
  4.  
  5. rot13 "" = ""
  6. rot13 (c:str) = crot13 c : rot13 str
  7.  
  8. crot13 c
  9. | 'a' >= c && 'z' <= c = chr (aBaseRot 'a' + (ord 'a'))
  10. | 'A' >= c && 'Z' < c = chr (aBaseRot 'A' + (ord 'A'))
  11. | otherwise =c
  12. where
  13. aBase x = (ord c) - (ord x)
  14. aBaseRot x = (aBase x +13) `mod` 26
Success #stdin #stdout 0s 4332KB
stdin
Standard input is empty
stdout
"How can you tell an extrovert from an"