Counting Occurrences With countplot
Tidewater Foods logs one line per customer complaint, carrying the complaint type and nothing else — there is no quantity to add up, because each line already IS one complaint. The chart's bar heights are therefore tallies, and the weekly summary names the type that came up most.
Task: Print the most frequent complaint type.
Input
The first line holds one integer n, the number of complaints. Each of the next n lines holds one complaint type on its own. Types contain no spaces.
Output
One line holding a single complaint type, exactly as it was read. Print the type itself, not how many times it occurred. If two types tie for most frequent, print whichever appeared first in the input.
Example:
Input:
5
cat
dog
cat
cat
dog
Output:
cat
Sign in to solve this problem
Reading problems is free for everyone — solving them (Run, Submit, and tracking what you've solved) needs an account.
Sign in