input: Write a function to find the total number of common characters between two given strings. The function should return the count of characters that are present in both strings.
  
  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") == 3
  assert num_common_chars("abc", "def") == 0
  assert num_common_chars("aabbcc", "abc") == 3
  assert num_common_chars("", "test") == 0
  assert num_common_chars("common", "monkey") == 4
output: def num_common_chars(str1, str2):
      common = 0
      for c in set(str1):
          if c in str2:
              common += min(str1.count(c), str2.count(c))
      return common