Files
aoc/06/f.py

25 lines
512 B
Python

import os
input = open(os.path.dirname(__file__) +
"/input.txt", "r").read()
index, index1, index2 = 0, 0, 0
buf = []
for x in input:
index += 1
buf.append(x)
if index1 == 0 and len(buf) == 4:
if len(set(buf)) == 4:
index1 = index
buf.pop(0)
if index2 == 0 and len(buf) == 14:
if len(set(buf)) == 14:
index2 = index
break
buf.pop(0)
print("First answer: " + str(index1))
print("Second answer: " + str(index2))