#C3902. Count Palindromic Substrings

    ID: 47381 Type: Default 1000ms 256MiB

Count Palindromic Substrings

Count Palindromic Substrings

Given a string \( S \), count the number of palindromic substrings in \( S \). A substring is considered palindromic if it reads the same backward as forward. Note that every single character is inherently a palindrome.

For example, if \( S = \texttt{abba} \), the palindromic substrings are: \( \texttt{a, b, b, a, bb, abba} \), totaling \( 6 \) palindromes. Use an efficient center expansion approach to solve this problem.

inputFormat

The input consists of a single line containing the string \( S \) (which may include both lowercase and uppercase letters).

outputFormat

Output the total number of palindromic substrings in \( S \) as an integer.

## sample
a
1