input: Write a function to find the number of common substrings between two given strings. If there are no common substrings, return 0. The function should return the count as an integer.
  assert num_common_substrings("abcd", "bae")==2
  assert num_common_substrings("abc", "def")==0
  assert num_common_substrings("hello", "world")==1
  assert num_common_substrings("aaa", "aaaa")==3
  assert num_common_substrings("", "abc")==0
output: def num_common_substrings(s1, s2):
      set1 = set(s1[i:j] for i in range(len(s1)) for j in range(i + 1, len(s1) + 1))
      set2 = set(s2[i:j] for i in range(len(s2)) for j in range(i + 1, len(s2) + 1))
      return len(set1 & set2)