input: def num_common_substrings(s1: str, s2: str) -> int:
      """
      Count the number of common characters between two strings.
  
      >>> num_common_substrings("abcd", "bae")
      2
      """
output:     count = 0
      set1 = set(s1)
      set2 = set(s2)
      for char in set1:
          if char in set2:
              count += 1
      return count