def sequence_in(s1, s2):
    """Does `s1` appear in sequence in `s2`?"""
pat = '.*'.join(s1)
if re.search(pat, s2):
    return True
return False

def sequence_in(s1, s2):
    """Does `s1` appear in sequence in `s2`?"""
return bool(re.search('.*'.join(s1), s2))
a = 'abcde'
b = 'ace'
c = 'acb'
assert sequence_in(b, a)
assert not sequence_in(c, a)
Найти подпоследовательности строк в строках