input: Write a python function to find the longest common substring between two given strings.
  assert longest_common_substring('abcdef', 'abfdef') == 'def'
  assert longest_common_substring('geeksforgeeks', 'geeksquiz') == 'geeks'
  assert longest_common_substring('abcdxyz', 'xyzabcd') == 'abcd'
output: def longest_common_substring(str1, str2):
      m = len(str1)
      n = len(str2)
      result = 0
      end = 0
      length = [[0] * (n + 1) for _ in range(m + 1)]
      
      for i in range(1, m + 1):
          for j in range(1, n + 1):
              if str1[i - 1] == str2[j - 1]:
                  length[i][j] = length[i - 1][j - 1] + 1
                  if length[i][j] > result:
                      result = length[i][j]
                      end = i
      
      return str1[end - result: end]