Palindromic Substrings - Leetcode 647 - Python