input: Write a python function to find the longest common substring between two given strings.
  assert longest_common_substring("abcdef", "zabcf") == "abc"
  assert longest_common_substring("xyzabcd", "abcdxyz") == "abcd"
  assert longest_common_substring("1234", "3412") == "12"
  assert longest_common_substring("hello", "ell") == "ell"
  assert longest_common_substring("abcdefg", "hijklmn") == ""
output: def longest_common_substring(str1, str2):
      def find_lcs(s1, s2):
          len1, len2 = len(s1), len(s2)
          dp = [[0] * (len2 + 1) for _ in range(len1 + 1)]
          max_length = 0
          end_pos = 0
          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_length:
                          max_length = dp[i][j]
                          end_pos = i
          return s1[end_pos - max_length:end_pos]
      
      return find_lcs(str1, str2)