So I have two words. I want to write a function that finds the maximum overlap going from each word to the other. Example:
words = ['AAB', 'BAA']
find_overlap('AAB', 'BAA')
Should output B and size 1, and:
find_overlap('BAA', 'AAB')
Should output AA and size 2. Any suggestions on how to do it?
Edit: So I tried difflib.SequenceMatcher from python, but I don't understand the output.
s1 = "AAB"
s2 = "BAA"
s = difflib.SequenceMatcher(None, s1, s2)
pos_a, pos_b, size = s.find_longest_match(0, len(s1), 0, len(s2))
print(pos_a, pos_b, size)