input: Write a python function to find the longest common substring between two given strings.
  assert longest_common_substring("HelloWorld", "WorldHello") == "Hello"
  assert longest_common_substring("abcdef", "zabcf") == "abc"
  assert longest_common_substring("12345", "234") == "234"
output: def longest_common_substring(s1, s2):
      m, n = len(s1), len(s2)
      max_len = 0
      ending_index = m
      length_matrix = [[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]:
                  length_matrix[i][j] = length_matrix[i - 1][j - 1] + 1
                  if length_matrix[i][j] > max_len:
                      max_len = length_matrix[i][j]
                      ending_index = i
              else:
                  length_matrix[i][j] = 0
  
      return s1[ending_index - max_len: ending_index]