Create count_occurrences.py

Solution for count occurrences.