2022/day6/part2.py

21 lines
375 B
Python

from common import parse
def all_different_characters(input: str) -> bool:
return all(map(lambda c: input.count(c) == 1, input))
def solve(input: str) -> int:
i = 0
while i < len(input) and not all_different_characters(input[i : i + 14]):
i += 1
return i + 14
def main():
print(solve(parse("input")))
if __name__ == "__main__":
main()