import Control.Applicative
import Data.List

main = do
    dataset <- getContents
    mapM_ (mapM_ putStrLn.decodeCaesar) (lines dataset)

shiftChar :: Int -> Char -> Char
shiftChar n c
    | c == '.' = '.'
    | c == ' ' = ' '
    | c == '\n' = '\n'
    | otherwise = toEnum.(+97).(`mod` 26).(+ n).subtract 97.fromEnum $ c

shiftString :: Int -> String -> String
shiftString n = map (shiftChar n)

decodeCaesar :: String -> [String]
decodeCaesar str = filter (\s -> ("this" `isInfixOf` s) || ("that" `isInfixOf` s) || ("the" `isInfixOf` s))
    $ map shiftString [1..25] <*> [str]

