#C4015. Palindromic Substrings Counting

    ID: 47507 Type: Default 1000ms 256MiB

Palindromic Substrings Counting

Palindromic Substrings Counting

Given a string s consisting of lowercase English letters, your task is to count the number of substrings of s that are palindromes. A substring is defined as a contiguous sequence of characters within the string, and a palindrome is a string which reads the same backwards as forwards.

For example, if s = "ababa", there are 9 palindromic substrings. Note that when the string consists of a single repeated character, say a repeated n times, the total number of palindromic substrings is given by the formula: \(\sum_{i=1}^{n} i\).

Input is provided from standard input (stdin) and output should be printed to standard output (stdout).

inputFormat

The input consists of a single line string s containing only lowercase English letters.

outputFormat

Output a single integer representing the total number of palindromic substrings in the string s.

## sample
a
1