#C1579. Count Palindromic Substrings

    ID: 44799 Type: Default 1000ms 256MiB

Count Palindromic Substrings

Count Palindromic Substrings

Given a string \( s \) consisting of lowercase English letters, determine the total number of palindromic substrings present in \( s \). A palindrome is defined as a string that reads the same forwards and backwards. For example, "madam" and "racecar" are palindromic strings.

Problem Constraints:

  • The input string \( s \) satisfies \( 1 \leq |s| \leq 10^5 \).

Example: For \( s = "a" \), there is exactly one palindromic substring ("a").

inputFormat

Input is provided via standard input (stdin) as a single line containing the string ( s ).

outputFormat

Output to standard output (stdout) a single integer representing the total number of palindromic substrings in ( s ).## sample

a
1