#K66672. Count Palindromic Substrings
Count Palindromic Substrings
Count Palindromic Substrings
You are given a string s
consisting of lowercase English letters. Your task is to count the total number of substrings of s
that are palindromic. A palindrome is a string that reads the same backward as forward. In mathematical terms, a substring s[i...j]
is a palindrome if:
\( s[i] = s[j] \) and \( s[i+1 \ldots j-1] \) is a palindrome.
The string may be empty as well, in which case the answer is 0
.
inputFormat
The input consists of a single line containing the string s
. This string is composed only of lowercase English letters. It may be an empty string.
outputFormat
Output a single integer representing the total count of palindromic substrings present in the input string.
## samplea
1