All pastes #980022 Raw Edit

Stuff

public text v1 · immutable
·published 2008-04-10 19:09 UTC
rendered paste body
module Main where

import Data.Char
import Data.List
import Text.Printf

isVowel :: Char -> Bool
isVowel c = toUpper c `elem` "AEIOU"

main :: IO ()
main = do
    content <- getContents
    let (vowels, consonants) = partition isVowel $ filter isAlpha content
    let total = fromIntegral $ length vowels + length consonants
    printf "Vowels    : %.2f\n" (fromIntegral (length vowels) / total :: Float)
    printf "Consonants: %.2f\n" (fromIntegral (length consonants) / total :: Float)