input: Write a python function to find the longest palindromic substring.
  assert longest_palindromic_substring("forgeeksskeegfor") == "geeksskeeg"
  assert longest_palindromic_substring("babad") == "bab"
  assert longest_palindromic_substring("cbbd") == "bb"
  assert longest_palindromic_substring("a") == "a"
  assert longest_palindromic_substring("ac") == "a"
output: def longest_palindromic_substring(s):
      def expand_around_center(s, left, right):
          while left >= 0 and right < len(s) and s[left] == s[right]:
              left -= 1
              right += 1
          return s[left + 1:right]
  
      if not s or len(s) == 1:
          return s
  
      longest = ""
      for i in range(len(s)):
          # Odd length palindrome
          substr1 = expand_around_center(s, i, i)
          # Even length palindrome
          substr2 = expand_around_center(s, i, i + 1)
          
          # Update the longest palindrome found
          if len(substr1) > len(longest):
              longest = substr1
          if len(substr2) > len(longest):
              longest = substr2
  
      return longest