loading...

Discussion on: Daily Challenge #29 - Xs and Os

Collapse
craigmc08 profile image
Craig McIlwrath

Haskell:

import Data.Char (toLower)

xo :: String -> Bool
xo xs = let o's = count 'o' str
            x's = count 'x' str
            str = map toLower xs
            count c = foldl (\sum char -> if c == char then sum + 1 else sum) 0
        in o's == x's