Have you ever been uncertain how to spell a word? If you ask someone, they will sometimes just tell you to look it up, and that’s fine if you know how the word starts. However, it’s not much help if you only feel certain about how the word ends. To help give a equal treatment to words that are easy to spell at the end, you have developed the DyslectionaryTM. The Dyslectionary is just like an ordinary dictionary except that it organizes words based on how they end rather than how they start. The first section covers words ending with ‘a’. Within this section words are ordered by their second-to-last letter, and so on. If two words have the same suffix, the shorter word is sorted earlier. To help organize your Dyslectionary, you are developing a simple computer program to harvest words from ordinary dictionaries.
Input contains up to 100 word groups. Each word group contains up to 100 words, one word per line, listed in regular dictionary order. All words contain only lowercase letters a - z. A blank line separates each pair of consecutive groups.
For each group, print out its words in Dyslectionary order, one word per line. Use a blank line to separate consecutive groups. To make words easy to lookup, right-justify them so that they all end at the same column and there is just enough space to fit all the words.
|Sample Input 1||Sample Output 1|
apple banana grape kiwi pear airplane bicycle boat car
banana apple grape kiwi pear bicycle airplane car boat