Advertisement
Guest User

82

a guest
Jan 24th, 2019
108
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
  1. (fn [s]
  2.   (letfn [(p [s]
  3.              (if (next s)
  4.                (apply concat
  5.                       (for [x s] (map #(cons x %) (p (disj s x)))))
  6.                [s]))
  7.           (l [s t]
  8.              (let [i (count (take-while #(apply = %) (partition 2 (interleave s t))))
  9.                    s (subs s i)
  10.                    t (subs t i)
  11.                    f #(apply str (rest %))
  12.                    u (f s)
  13.                    v (f t)]
  14.                (or (= u v) (= s v) (= t u))))]
  15.     (boolean (some (fn [c] (every? #(apply l %) (partition 2 1 c))) (p s)))))
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement