Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- def day06(filepath, unique_length):
- with open(filepath) as fin:
- line = fin.readline()
- for i in range(len(line)):
- fourset = line[i:i+unique_length]
- if all([fourset.count(line[j]) == 1 for j in range(i, i+unique_length)]):
- return i + unique_length
- def main():
- assert day06('test06', 4) == 7
- print(day06('input06', 4))
- assert day06('test06', 14) == 19
- print(day06('input06', 14))
- if __name__ == '__main__':
- main()
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement