Longest Common Sequence Python