input: Write a function to find the total number of common characters present in both strings. If either string is empty, return 0.
  def num_common_chars(str1, str2):
      common = 0
      for c in str1:
          if c in str2:
              common += 1
      return common
  assert num_common_chars("hello", "world")==2
  assert num_common_chars("abc", "def")==0
  assert num_common_chars("abc", "aabbcc")==3
  assert num_common_chars("", "abc")==0
  assert num_common_chars("abc", "")==0
output: def num_common_chars(str1, str2):
      if not str1 or not str2:
          return 0
      common = 0
      seen = set()
      for c in str1:
          if c in str2 and c not in seen:
              common += 1
              seen.add(c)
      return common