3.5 Decoding the Ancient Symmetries
Gauresh has found delicate ancient texts containing a mysterious language,he needs a tool to count palindromes in ancient texts. Generate an algorithm that counts all posiible palindromes in the texts before the texts decayed.
Constraints
1 <= s.length <= 2000
s consists of lowercase English letters.
Input Format
Single string of lowercase alphabets
Output Format
Single integer(count of all palindromic substrings in the orignal string)
Example 1
Input:
madam
Output:
7
Explanation:
Here are the 7 palindromic substrings in the string "madam":"m","a","d","a","m","ada","madam"
Log In to solve the Question