input: Write a function to determine the longest common substring between two given strings. The function should take two strings as arguments and return the longest common substring between them. If there is no common substring, the function should return an empty string.
  assert longest_substring("abcdabcdabde", "defabcdabcd")=="abcdabcd"
  assert longest_substring("abc", "xyz")==""
  assert longest_substring("hello", "world")=="lo"
  assert longest_substring("programming", "gramps")=="gram"
  assert longest_substring("", "anyword")==""
output: def longest_substring(s1, s2):
      m, n = len(s1), len(s2)
      max_len = 0
      end_index = 0
      dp = [[0] * (n + 1) for _ in range(m + 1)]
      
      for i in range(1, m + 1):
          for j in range(1, n + 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]