user
You need to complete the following task:

Design a function to count the number of unique characters in a string.

string = “Butterflies”

Answer:
assistant
def count_unique_chars(string):
  char_dict = {}
  for char in string:
    if char in char_dict:
      char_dict[char] += 1
    else:
      char_dict[char] = 1
  return len(char_dict)

print(count_unique_chars("Butterflies"))
# Output: 9