input: Write a python function to find the longest palindromic substring in a given string.
  assert longest_palindromic_substring("cabbad") == "abba"
  assert longest_palindromic_substring("racecar") == "racecar"
  assert longest_palindromic_substring("babad") == "bab"
  assert longest_palindromic_substring("forgeeksskeegfor") == "geeksskeeg"
output: def longest_palindromic_substring(s: str) -> str:
      if len(s) == 0:
          return ""
      
      start = 0
      end = 0
      
      for i in range(len(s)):
          len1 = expand_around_center(s, i, i)
          len2 = expand_around_center(s, 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 s[start:end + 1]
  
  def expand_around_center(s: str, 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