input: Write a python function to find the longest common substring between two input strings.
  assert longest_substring("helloworld", "worldhello") == "world"
  assert longest_substring("abcdef", "zabcydef") == "abc"
  assert longest_substring("python", "typhoons") == "thon"
  assert longest_substring("abc", "def") == ""
output: def longest_substring(s1, s2):
      len1, len2 = len(s1), len(s2)
      max_len = 0
      end_index = 0
      dp = [[0] * (len2 + 1) for _ in range(len1 + 1)]
      
      for i in range(1, len1 + 1):
          for j in range(1, len2 + 1):
              if s1[i - 1] == s2[j - 1]:
                  dp[i][j] = dp[i - 1][j - 1] + 1
                  if dp[i][j] > max_len:
                      max_len = dp[i][j]
                      end_index = i
      
      return s1[end_index - max_len:end_index]