Count all palindromic contiguous substrings of s. Substrings with identical text at different positions count separately, and every single character is a palindrome.
Input / output
s: stringExamples
"abc" returns 3."aaa" returns 6: three single characters, two "aa" substrings, and one "aaa".Constraints
1 <= s.length <= 1,000s contains lowercase English letters.Follow-up
Explain why expanding around 2n - 1 centers is quadratic time but constant extra space.