blob: 1cb38eb53c2bfeddcb01d2404bfa8f98dd56576d (
plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
|
-- https://www.codewars.com/kata/54b42f9314d9229fd6000d9c
module Dups where
import Data.Char
count s c
| s == [] = 0
| c == (head s) = 1 + count (tail s) c
| otherwise = count (tail s) c
convert s c
| count s c > 1 = ')'
| otherwise = '('
duplicateEncode :: String -> String
duplicateEncode s = map (convert ls) ls
where ls = map toLower s
|