10359 - I2P homework11   

Description

Given a list of English names, use ‘qsort’ to sort the names in lexicographic order.
Please see our course webpage for the information about using ‘qsort’, or see the link
http://www.cplusplus.com/reference/cstdlib/qsort/

The detailed rules of sorting are:
1. Sort the strings in alphabetical order. E.g. “abc” is prior to “abd”.
2. The uppercase alphabet has top priority. E.g. “AA” is prior to “e”, or “Ef” is prior to “e”.
3. The string with smaller length is prior to larger length. E.g. “abc” is prior to “abcd”.
 

Input

Number of names
Name 1
Name 2
Name 3

 

Output

Print the sorted names line by line. Each line contains one name and ends with a newline character.
 

Sample Input  Download

Sample Output  Download

Tags




Discuss