Mock CCC '19 Contest 1 J4 - Pusheen Plays Neko Atsume

View as PDF

Submit solution

Points: 3 (partial)
Time limit: 1.0s
Memory limit: 1G

Problem type

Pusheen is playing Neko Atsume! She's been purchasing a lot of the premium food recently to attract rare cats, and wants to know how much of each she's been purchasing. Help her figure out how many of each type of food she's ordered!


1 \le N \le 10^5

The foods that Pusheen ordered come from the following set.

  • Deluxe Tuna Bitz
  • Bonito Bitz
  • Sashimi
  • Ritzy Bitz

In tests worth 3 marks, Pusheen only ordered one type of food.

In tests worth an additional 5 marks, if Pusheen ordered two types of food a nonzero number of times, she ordered different quantities of both.

Input Specification

The first line contains a single positive integer N, the number of times Pusheen purchased premium food.

Each of the next N lines contains a string representing the food that Pusheen ordered.

Output Specification

For each type of food that Pusheen ordered, output a line indicating the food she purchased and the number of times she purchased that food. Sort the foods in non-increasing order of number of times purchased. If two types of food were purchased the same number of times, tiebreak them by printing the ones earlier on the following list first.

  • Deluxe Tuna Bitz
  • Bonito Bitz
  • Sashimi
  • Ritzy Bitz

Sample Input

Bonito Bitz
Bonito Bitz

Sample Output

Bonito Bitz 2
Sashimi 1

Sample Explanation

Pusheen purchased Bonito Bitz twice and Sashimi once. Because she purchased Bonito Bitz more times, it appears before Sashimi. This would have also been the case if she had ordered Sashimi twice.


There are no comments at the moment.