input: Write a function that takes two strings and returns whether they are anagrams. If the length of the two strings is different, return False immediately. Otherwise, count the frequency of each character in both strings and compare these frequencies. If all character frequencies match, return True; otherwise, return False. 
  
  def is_anagram(str1, str2):
      if len(str1) != len(str2):
          return False
      str1_counts = collections.Counter(str1)
      str2_counts = collections.Counter(str2)
      for char in str1_counts:
          if str1_counts[char] != str2_counts[char]:
              return False
      return True
  
  assert is_anagram("abcd", "cbda")==True
  assert is_anagram("listen", "silent")==True
  assert is_anagram("hello", "world")==False
  assert is_anagram("python", "typhon")==True
  assert is_anagram("anagram", "nagaram")==True
output: def is_anagram(str1, str2):
      if len(str1) != len(str2):
          return False
      str1_counts = collections.Counter(str1)
      str2_counts = collections.Counter(str2)
      for char in str1_counts:
          if str1_counts[char] != str2_counts[char]:
              return False
      return True