input: 
  def num_common_substrings(s1: str, s2: str) -> int:
      """
      Given two strings s1 and s2, returns the number of common substrings between them.
      
      >>> num_common_substrings("abcd", "bae")
      2
      """
      count = 0
      for i in range(len(s1)):
          for j in range(len(s2)):
              if s1[i:i+1] == s2[j:j+1]:
                  count += 1
      return count
  
output:     count = 0
      for i in range(len(s1)):
          for j in range(len(s2)):
              if s1[i:i+1] == s2[j:j+1]:
                  count += 1
                  k = 1
                  while i+k < len(s1) and j+k < len(s2) and s1[i+k] == s2[j+k]:
                      count += 1
                      k += 1
      return count