import System.IO import Control.Monad import Data.List num :: String -> String -> Int num [] [] = 0 num (x:xs) (y:ys) | x == y = 1 + num xs ys | otherwise = num xs ys percentage key sub = (num key sub) `div` (genericLength key) passOrFail :: (Fractional a) => a -> String passOrFail x | x < 0.9 = "fail" | otherwise = "pass" main :: IO () main = do key <- getLine putStrLn "You entered the key" input_line <- getLine let n = read input_line :: Int replicateM n $ do str <- getLine putStrLn "Bravo!" let p = passOrFail $ percentage key str putStrLn p return () return ()