Count Palindromic Substrings Leetcode Javascript