input: 
  def num_common_substrings(s1: str, s2: str) -> int:
      """
      Given two strings, the function returns an integer indicating the number of common substrings between the two strings.
      >>> num_common_substrings("abcd", "bae")
      3
      """
      count = 0
      for i in range(len(s1)):
          for j in range(len(s2)):
              if s1[i] == s2[j]:
                  count += 1
      return count
  
output:     for k in range(1, min(len(s1) - i, len(s2) - j)):
          if s1[i:i+k+1] == s2[j:j+k+1]:
              count += 1
          else:
              break