input: Write a function to create a Python program that takes in two strings and returns an integer indicating the number of common substrings between the two strings. If either string is empty, return 0.
  def num_common_substrings(s1, s2):
      count = 0
      for i in range(len(s1)):
          for j in range(len(s2)):
              if s1[i] == s2[j]:
                  count += 1
      return count
  assert num_common_substrings("abcd", "bae")==2
  assert num_common_substrings("abc", "def")==0
  assert num_common_substrings("", "abc")==0
  assert num_common_substrings("xyz", "")==0
  assert num_common_substrings("", "")==0
output: def num_common_substrings(s1, s2):
      if not s1 or not s2:
          return 0
      count = 0
      for i in range(len(s1)):
          for j in range(len(s2)):
              k = 0
              while i + k < len(s1) and j + k < len(s2) and s1[i + k] == s2[j + k]:
                  k += 1
                  count += 1
      return count