input: Write a function to count the total number of common characters between two given strings. If one or both of the strings are empty, return 0 as there are no common characters.
  
  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("aaaa", "bbb")==0
  assert num_common_chars("aaaa", "aaaa")==4
  assert num_common_chars("", "world")==0
  assert num_common_chars("hello", "")==0
output: def num_common_chars(str1, str2):
      common = 0
      for c in str1:
          if c in str2:
              common += 1
              str2 = str2.replace(c, '', 1)
      return common