#K5236. Symmetrical Substring Count
Symmetrical Substring Count
Symmetrical Substring Count
You are given a string s consisting of lowercase letters. Your task is to count the number of symmetrical substrings, i.e. palindromic substrings, in s.
A substring is a contiguous sequence of characters within the string. A palindrome is a string that reads the same backward as forward. For example, in the string abac
, the palindromic substrings are: a
, b
, a
, c
and aba
, totaling 5 palindromic substrings.
The mathematical concept can be represented using LaTeX where a palindrome P satisfies:
\( P = \text{reverse}(P) \)
Write a program that reads a string from standard input and outputs the count of symmetrical substrings to the standard output.
inputFormat
The input consists of a single line containing the string s (1 ≤ |s| ≤ 104), where |s| denotes the length of the string, comprised of lowercase English letters.
Input is read from stdin.
outputFormat
Output a single integer — the total count of symmetrical (palindromic) substrings in the given string.
Output should be written to stdout.
## samplea
1
</p>