Shortest Palindrome Leetcode Solutions Python