input: Write a function to calculate the number of common characters between two strings. The function should return the count of characters that appear in both strings. If either of the strings is empty, the function should return 0.
  def num_common_characters(s1, s2):
      count = 0
      for char in set(s1):
          if char in s2:
              count += 1
      return count
  assert num_common_characters("abcd", "bae")==2
  assert num_common_characters("hello", "world")==3
  assert num_common_characters("abc", "def")==0
  assert num_common_characters("", "bae")==0
  assert num_common_characters("abcd", "")==0
output: def num_common_characters(s1, s2):
      count = 0
      for char in set(s1):
          if char in s2:
              count += 1
      return count