Add additional solution for count_by_type exercise.