#K32822. Count Distinct Palindromic Substrings
Count Distinct Palindromic Substrings
Count Distinct Palindromic Substrings
Given a string s, count the number of distinct palindromic substrings in it. A substring s[i...j] (where 0 ≤ i ≤ j < n and n is the length of s) is considered palindromic if it reads the same forwards and backwards. In mathematical terms, a substring s[i...j] is palindromic if \(s[i...j] = (s[i...j])^R\), where \((s[i...j])^R\) denotes the reversal of the substring.
inputFormat
The input consists of a single line containing the string s. The string can include letters, digits, and other characters. It is read from standard input (stdin).
outputFormat
Output a single integer to standard output (stdout) representing the number of distinct palindromic substrings in s.
## sampleabac
4