AdventOfCode/2022/day6/day6_part1.py

24 lines
496 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)-3):
temp=""
for j in range(0,4):
temp += letters[i+j]
if not find_dupe(temp):
print(temp)
print(i+4)
break