#K70072. Organize Bookshelf
Organize Bookshelf
Organize Bookshelf
You are given a list of book titles. Your task is to group these titles by their first letter and sort each group in lexicographical (alphabetical) order. The groups themselves should be ordered by the first letter in ascending order. When printing, the sorted titles in each group should be printed on separate lines, and a blank line should separate different groups. If there is only one group, print the titles without any extra blank lines. If the list is empty, output an empty string.
Note: All comparisons are case-sensitive. You can assume that each title is a non-empty string without leading spaces.
Examples:
Input: 3 apple apricot avocado</p>Output: apple apricot avocado
Input: 4 dog cat duck cow
Output: cat cow
dog duck
inputFormat
The first line of input contains an integer n (n ≥ 0) representing the number of book titles. The following n lines each contain a single book title.
If n is 0, then no titles follow and the output should be an empty string.
outputFormat
Output the grouped and sorted book titles. Titles within the same group should be printed on separate lines, and different groups should be separated by a single blank line. There should be no extra blank line at the end.
## sample3
apple
apricot
avocado
apple
apricot
avocado
</p>