Untitled

mail@pastecode.io avatar
unknown
python
a year ago
613 B
2
Indexable
Never
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))]))