AdventOfCode/2022/day6/day6_part2.py

24 lines
499 B
Python

import sys
from pprint import pprint
from collections import Counter
with open(sys.argv[1], "r") as f:
line = [line.rstrip('\n') for line in f]
print(line[0])
letters = line[0]
def find_dupe(input):
WC = Counter(input)
for letter, count in WC.items():
if (count > 1):
return True
for i in range(0,len(letters)-13):
temp=""
for j in range(0,14):
temp += letters[i+j]
if not find_dupe(temp):
print(temp)
print(i+14)
break