aboutsummaryrefslogtreecommitdiff
path: root/2022/06/solve.py
blob: 5de1270f5de41bd0879afe3ca50245b1a75873aa (plain) (blame)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
data = [dat for dat in open("input").readlines() if dat != ''][0]

def part1():
    for i in range(4, len(data)):
        if len(data[i-4:i]) == len(set(data[i-4:i])):
            return i

def part2():
    for i in range(14, len(data)):
        if len(data[i-14:i]) == len(set(data[i-14:i])):
            return i

print(f"Part 1: {part1()}")
print(f"Part 2: {part2()}")