input: from typing import List
  
  
  def longest_common_substring(str1: str, str2: str) -> str:
      """ Find the longest common substring in two given strings.
      >>> longest_common_substring("Helwallomst", "Welcome")
      'lo'
      >>> longest_common_substring("abcdef", "xyz")
      ''
      """
output:     max_len = 0
      end_index = 0
      lengths = [[0] * (len(str2) + 1) for _ in range(len(str1) + 1)]
      
      for i in range(1, len(str1) + 1):
          for j in range(1, len(str2) + 1):
              if str1[i - 1] == str2[j - 1]:
                  lengths[i][j] = lengths[i - 1][j - 1] + 1
                  if lengths[i][j] > max_len:
                      max_len = lengths[i][j]
                      end_index = i
              else:
                  lengths[i][j] = 0
      
      return str1[end_index - max_len:end_index]