191k views
1 vote
A palindrome is a string that reads the same from the left and from the right. For example, mom and tacocat are palindromes, as are any single character strings. Given a string, determine the number of its substrings that are palindromes.

User Kamy
by
4.5k points

1 Answer

5 votes

Answer:

The answer is below

Step-by-step explanation:

Since palindrome is a string that reads the same from the left and from the right. For example, mom and tacocat are palindromes, as are any single character strings.

Therefore, given that the input word is: 'Redivider'

Hence, the Palindromic substrings are ['r', 'e', 'd', 'i', 'v', 'i', 'd', 'e', 'r', 'ivi', 'divid', 'edivide', 'redivider']. There are 13 palindromic substrings.

User Kbd
by
4.7k points