input: Write a function to find the length of the longest palindromic substring.
  assert longest_palindrome("babad") == 3
  assert longest_palindrome("cbbd") == 2
  assert longest_palindrome("a") == 1
  assert longest_palindrome("ac") == 1
output: def longest_palindrome(s: str) -> int:
      def expand_around_center(left: int, right: int) -> int:
          while left >= 0 and right < len(s) and s[left] == s[right]:
              left -= 1
              right += 1
          return right - left - 1
  
      if not s:
          return 0
  
      start, end = 0, 0
      for i in range(len(s)):
          len1 = expand_around_center(i, i)
          len2 = expand_around_center(i, i + 1)
          max_len = max(len1, len2)
          if max_len > end - start:
              start = i - (max_len - 1) // 2
              end = i + max_len // 2
  
      return end - start + 1