CRED may need to analyze short message strings for symmetry-based patterns. Given a string s, return the total number of palindromic substrings it contains.
A substring is a contiguous, non-empty sequence of characters. Count palindromic substrings by position, so identical text appearing at different positions is counted separately. For example, the two a characters in "aaa" are separate one-character palindromic substrings.
Implement count_palindromic_substrings(s).
s, a string containing lowercase English letters.s.def count_palindromic_substrings(s):