Sorting words

Given several words, compute the number of appearances of each one.
Print first the most common words, and use the lexicographical order to
break ties.

Input

Input consists of several cases. Every case begins with a number n
between 1 and 10⁴, followed by n words made up only of lowercase
letters.

Output

Print the counters and the words in the right order. Print a line with
10 dashes at the end of every case.

Problem information

Author: Unknown
Translator: Salvador Roura

Generation: 2026-01-25T11:30:22.458Z

© Jutge.org, 2006–2026.
https://jutge.org
