You are viewing a single comment's thread. Return to all comments →
A non-regex Clojure solution:
(defn compress [s] (->> (partition-by identity s) (map #(let [f (first %) c (count %)] (if (= c 1) f [f c]))) flatten (apply str))) (println (compress (read-line)))
Seems like cookies are disabled on this browser, please enable them to open this website
String Compression
You are viewing a single comment's thread. Return to all comments →
A non-regex Clojure solution: