Longest Common Substring Leetcode Practice Python