Minimum Length Substrings Leetcode Python