USING: arrays circular io.encodings.utf8 io.files kernel math namespaces scratchpad sequences sets ; FROM: namespaces => set ; IN: dec-6 : input ( -- string ) "/Users/zip/desktop/aoc2022/dec-6/input.txt" utf8 file-lines first ; : find-unique-n ( n string -- number ) swap f marker set 0 [ marker get [ all-unique? not ] [ f swap in? ] bi or ] [ [ unclip marker get circular-push ] dip 1 + ] while nip ; : part1 ( -- number ) 4 input find-unique-n ; : part2 ( -- number ) 14 input find-unique-n ;