Untitled
unknown
python
3 years ago
622 B
10
Indexable
s = input()
strings = []
while True:
try:
tmp = input().strip()
except EOFError:
break
strings.append(tmp)
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...