Palindromic Substrings
Examples
Example 1:
Input: s = "abc"
Output: 3
Explanation:
Example 2:
Input: s = "aaa"
Output: 6
Explanation:
Example 1:
Input: s = "abc"
Output: 3
Explanation:
Example 2:
Input: s = "aaa"
Output: 6
Explanation:
Given a string s, return the number of substrings within s that are palindromes.
A palindrome is a string that reads the same forward and backward.
"a", "b", "c".
"a", "a", "a", "aa", "aa", "aaa". Note that different substrings are counted as different palindromes even if the string contents are the same.
1 <= s.length <= 1000s consists of lowercase English letters.