-- Written by Mohit Jain
-- Input: A string containing only letters 'a'-'z'
-- Output: True if string is a valid name, False otherwise
-- Rules: A name is valid if it follows all the rules given below.
-- 1. Length of name is exactly 8 characters.
-- 2. Name contains exactly 2 vowels.
-- 3. Both vowels are same.
module Main where
main = ( putStrLn . unlines . map show . map isValid ) ["chammach",
"chamcham",
"chumchum",
"trezrent",
"abcdefgh",
"trezrents",
"martrent",
"mohit",
"mohitjain"]
isValid name = if (nameLen /= 8) then False else (eval nameVow) where
nameLen = length name
nameVow = filter (\x -> elem x "aeiou") name
eval vow = if (length vow /= 2) then False else (vow!!0 == vow!!1)