Advent of Code 2022 day 6

Code for part 2. For part 1 replace 14 with 4.

with open("6.txt") as f:
    text = f.read()

print(len(text))
for i in range(len(text)):
    if len(set(text[i:i+14])) == 14:
        print(i+14)
        print(text[i:i+14])
        exit()