Palindromic Substrings
Medium
Topics
Given a string s, return the number of palindromic substrings in it. Substrings at different start or end positions count separately even if identical.
Example 1
Input: s = "abc" Output: 3 Explanation: The three single characters.
Example 2
Input: s = "aaa" Output: 6
Constraints
- 1 <= s.length <= 1000
- s consists of lowercase English letters.
Run ⌘' · Submit ⌘⏎