import aoclib from collections import deque inp = aoclib.get_input(6) def find_marker(message, after=4): buf = deque([], maxlen=after) for i, letter in enumerate(message, 1): buf.append(letter) if len(buf) == after and len(set(buf)) == after: return i def part1(): return find_marker(inp) def part2(): return find_marker(inp, 14) aoclib.main(part1, part2)