input: Write a function to count the occurrence of each character in a given string and return the result as a dictionary where keys are characters and values are their respective counts. If the input string is empty, return an empty dictionary.
  assert char_occurrences("Hello, World!")=={'H': 1, 'e': 1, 'l': 3, 'o': 2, ',': 1, ' ': 1, 'W': 1, 'r': 1, 'd': 1, '!': 1}
  assert char_occurrences("abracadabra")=={'a': 5, 'b': 2, 'r': 2, 'c': 1, 'd': 1}
  assert char_occurrences("")=={}
  assert char_occurrences("Mississippi")=={'M': 1, 'i': 4, 's': 4, 'p': 2}
output: def char_occurrences(s):
      if not s:
          return {}
      result = {}
      for char in s:
          if char in result:
              result[char] += 1
          else:
              result[char] = 1
      return result