advent-of-code/12022/06/06.fnl

17 lines
358 B
Fennel

(io.input "test")
(λ repeats [s]
(let [chars {}]
(for [i 1 (length s)]
(let [c (string.sub s i i)]
(if (. chars c) true (tset chars c true)))))
false)
(λ end-of-marker [s n]
(for [i 1 (length s)]
(let [window (string.sub s i (+ i (- n 1)))]
(print window))))
(end-of-marker (io.read "a") 4)
(print (repeats "aacd"))