set2 = set(s2[begin:end] for begin, end in itertools.combinations(list(range(len
    (s2) + 1)), 2))
common = set1.intersection(set2)
maximal = [com for com in common if sum(s.find(com) for s in common) == -1 *
    (len(common) - 1)]
return [(s, s1.index(s), s2.index(s)) for s in maximal]
Python – как найти все пересечения двух строк?