input: Write a function that takes in two strings and returns an integer indicating the number of common substrings between the two strings. If either of the strings is empty, return 0.
  
  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)):
              len_sub = 0
              while i + len_sub < len(s1) and j + len_sub < len(s2) and s1[i + len_sub] == s2[j + len_sub]:
                  len_sub += 1
                  if len_sub > 1:
                      count += 1
      return count
  
  assert num_common_substrings("abcd", "bae") == 1
  assert num_common_substrings("abc", "") == 0
  assert num_common_substrings("", "def") == 0
  assert num_common_substrings("aaaa", "aa") == 3
  assert num_common_substrings("abc", "def") == 0
  assert num_common_substrings("ababab", "ab") == 5
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)):
              len_sub = 0
              while i + len_sub < len(s1) and j + len_sub < len(s2) and s1[i + len_sub] == s2[j + len_sub]:
                  len_sub += 1
                  if len_sub > 1:
                      count += 1
      return count