DEV Community

Discussion on: Daily Challenge #259 - Duplicate Encoder

Collapse
 
jvanbruegge profile image
Jan van Brügge • Edited

My Haskell solution:

import Data.Char (toLower)

encode str = (\n -> if n > 1 then ')' else '(' )
        <$> fmap (\c -> length $ filter ((==) c) str') str'
    where str' = fmap toLower str