#K33232. Count Palindromic Substrings
Count Palindromic Substrings
Count Palindromic Substrings
You are given a string S. Your task is to calculate the total number of palindromic substrings in S. A substring is a contiguous sequence of characters within a string, and it is palindromic if it reads the same forward and backward. Formally, if S has length n, you are to count all substrings S[i...j] (0 ≤ i ≤ j < n) such that
For example, for the string "aa", the palindromic substrings are "a", "a", and "aa", which totals to 3. Your solution should read from standard input (stdin) and output the result to standard output (stdout).
inputFormat
The input consists of a single line containing the string S. The string will consist of lowercase English letters only.
outputFormat
Output a single integer representing the total number of palindromic substrings in S.## sample
a
1