By Emilio Wuerges, UFFS Brazil
The lexicon problem taught us how to sort 2 words. However, when the list of words was being built, the intern in charge made the mistake of including Uppercase characters!
Now we have a huge list of words, with both lowercase, from a to z, and uppercase characters, from A to Z!
We need to sort them, obeying the same order as before, regardless if the character is lowercase or uppercase.
However, the uppercase characters will be used to break ties, once all letters have been compared. In this case we consider that the uppercase character comes first.
The first line contains an integer \(1 \leq N \leq 5 \times 10^4\).
Each of the following N lines contain a single word. Every word has at most 20 characters.
The output must contain the list of words, sorted.
Input Samples | Output Samples |
4 |
Abcd |
5 |
Abc |