Majority Element · Compiler
Majority Element
Each vote names one fruit. Find the fruit with strictly more than half of all votes, if one exists.
- Input
- Line 1 contains the number of votes n (1 to 100). Line 2 contains n space-separated fruit names of 1 to 12 lowercase ASCII letters each.
- Output
- Print the winning name, or NONE if no fruit has a strict majority.
Compiler Explorer runs your code when you run or check it.
Loading your exercise draft…