How To Find The Longest Substring In Python