input: Write a python function to find the longest common substring between two strings.
  assert longest_common_substring('string', 'longest') == 'ng'
  assert longest_common_substring('abcdef', 'zabcg') == 'abc'
  assert longest_common_substring('hello', 'world') == 'o'
  assert longest_common_substring('python', 'typhoon') == 'thon'
output: def longest_common_substring(str1, str2):
      m, n = len(str1), len(str2)
      max_len = 0
      ending_index = m
  
      # Create a 2D array to store lengths of longest common suffixes
      # Initialize all values to 0
      length_table = [[0] * (n + 1) for _ in range(m + 1)]
  
      # Building the length_table in bottom-up fashion
      for i in range(1, m + 1):
          for j in range(1, n + 1):
              if str1[i - 1] == str2[j - 1]:
                  length_table[i][j] = length_table[i - 1][j - 1] + 1
                  if length_table[i][j] > max_len:
                      max_len = length_table[i][j]
                      ending_index = i
              else:
                  length_table[i][j] = 0
  
      # If no common substring is found, return an empty string
      if max_len == 0:
          return ''
  
      # Longest common substring is from index ending_index - max_len to ending_index - 1
      return str1[ending_index - max_len: ending_index]