Untitled
unknown
python
2 years ago
613 B
5
Indexable
s = input() strings = [] while True: try: s = input() except EOFError: break strings.append(s) lengths = [] for line in strings: start_index = None end_index = None min_len = float('inf') for i, c in enumerate(line): if c in s and start_index is None: start_index = i elif c in s: if min_len > i - start_index: min_len = i - start_index start_index = i if min_len != float('inf') and min_len != 0: lengths.append(min_len + 1) print(", ".join([str(i) for i in sorted(set(lengths))]))
Editor is loading...