Count Palindromic Substrings Leetcode Javascript Question