123456789101112131415161718 |
- #!/usr/bin/python3
- import sys
- def search_distinct_set(datastream, length):
- index = length
- while len(set(datastream[index - length:index])) != length:
- index += 1
- #print(window, list(set(window)))
- return index
- def solution(length):
- for line in sys.stdin:
- print(f'first marker after character {search_distinct_set(line, length)}')
- if sys.argv[1] in '1':
- solution(4)
- else:
- solution(14)
|