(defn encode-modified [xs] (let [x (partition-by identity xs)] (map #(if (= 1 %1) (list %2) (list %1 %2)) (map count x) (map first x))))