Write a function that counts palindromes within a string, counting single-character substrings as palindromes.
Return the total number of contiguous substrings that read identically forward and backward. The input is a string, and the output is an integer.
Function signature: def count_palindromes(s):
def count_palindromes(s):