my solutions for advent of code 2022
You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
 

26 lines
543 B

with open('input6.txt','r') as f:
inp = f.read().splitlines(keepends=False)
inp = inp[0]
for i in range(3, len(inp)):
tempa = inp[i - 3:i+1]
tempc = 0
for x in tempa:
tempc += tempa.count(x)
if tempc == 4:
paketstart = i + 1
break
print('Start of packet', paketstart)
for i in range(13, len(inp)):
tempa = inp[i - 13:i+1]
tempc = 0
for x in tempa:
tempc += tempa.count(x)
if tempc == 14:
messagestart = i + 1
break
print('Start of Message', messagestart)