starts :: String -> String -> Bool starts first second = if length second > length first then False else if (take (length second) first) == second then True else False ends :: String -> String -> Bool ends first second = starts (reverse first) (reverse second) add_plural :: String -> String add_plural word | ends word "ch" = word ++ "es" | ends word "x" = word ++ "es" | ends word "s" = word ++ "es" | ends word "o" = word ++ "es" | ends word "f" = (take (length word-1) word) ++ "ves" | ends word "fe" = (take (length word-2) word) ++ "ves" | ends word "y" = (take (length word-1) word) ++ "ies" | otherwise = word ++ "s" run_test :: Int -> IO() run_test 0 = do return() run_test n = do word <- getLine putStrLn (add_plural word) run_test (n-1) main = do readLn >>= run_test