DEV Community

Discussion on: Daily Challenge #259 - Duplicate Encoder

Collapse
quoll profile image
Paula Gearon • Edited on

Clojure

(defn duplicate-encode
  [s]
  (let [s (clojure.string/lower-case s)
        f (frequencies s)]
    (apply str (map #(if (= 1 (f %)) \( \)) s))))