input: Write a python function to count the occurrences of each item in an array.
  assert count_occurrences(['a', 'b', 'a', 'c', 'a', 'b', 'd', 'a']) == {'a': 4, 'b': 2, 'c': 1, 'd': 1}
  assert count_occurrences([1, 2, 2, 3, 3, 3, 4]) == {1: 1, 2: 2, 3: 3, 4: 1}
  assert count_occurrences(['apple', 'banana', 'apple', 'orange', 'banana', 'apple']) == {'apple': 3, 'banana': 2, 'orange': 1}
output: def count_occurrences(arr):
      result = {}
      for item in arr:
          if item in result:
              result[item] += 1
          else:
              result[item] = 1
      return result