Skip to content

Instantly share code, notes, and snippets.

@oskimura
Created April 28, 2011 05:10
Show Gist options
  • Select an option

  • Save oskimura/945838 to your computer and use it in GitHub Desktop.

Select an option

Save oskimura/945838 to your computer and use it in GitHub Desktop.
{-# OPTIONS_GHC -O2 -optc-O3 -optc-ffast-math -cpp #-}
{-# OPTIONS_GHC -funbox-strict-fields -fexcess-precision -monly-3-regs #-}
{-# LANGUAGE BangPatterns, OverloadedStrings, ScopedTypeVariables #-}
{-# LANGUAGE NoMonomorphismRestriction #-}
module Main where
import Control.Applicative
import Data.List
import Text.Printf
splitBy :: (a -> Bool) -> [a] -> [[a]]
splitBy p [] = []
splitBy p xs = a : (splitBy p $ dropWhile p $ b)
where
(a, b) = break p xs
split :: String -> [String]
split = splitBy (==' ')
-- input = lines <$> readFile "input.txt"
input = lines <$> getContents
countVowel text = length xs
where
xs = intersect text vowel
vowel = "aeiou"
solve :: [String] -> String
solve xs = if ys == [5,7,5] then "YES" else "NO"
where ys = map countVowel $ xs
main :: IO ()
main = do { ns <- input
; printf "%s" . solve $ ns
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment