-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathDay6.py
More file actions
34 lines (30 loc) · 795 Bytes
/
Day6.py
File metadata and controls
34 lines (30 loc) · 795 Bytes
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
input = open("puzzle_input.txt", "r")
start_buffer_size = 4
msg_buffer_size = 14
offset = start_buffer_size
window = ""
line = input.readline()
#Part1
# for i in range(len(line)):
# if i < start_buffer_size: #initiate window
# window += line[i]
# else:
# print(set(window))
# if len(set(window)) == start_buffer_size:
# print(window)
# print(i)
# break
# window = window[1:] + line[i]
# print(window)
#Part2
for i in range(len(line)):
if i < msg_buffer_size: #initiate window
window += line[i]
else:
print(set(window))
if len(set(window)) == msg_buffer_size:
print(window)
print(i)
break
window = window[1:] + line[i]
print(window)