imagine that you are & mdash; Linguist-archaeologist, and you found an ancient artifact with a set of characters. You suggest that this is anam & mdash; A puzzle in which you need to rearrange the letters of a given word so that another word is obtained. To hack the cipher, you need to compile a full dictionary of all possible combinations of characters that could be encrypted.
rn
your task & mdash; Write a program that accepts one word (set of characters) to the input and displays all unique combinations (permutations) of these characters. For the convenience of analysis and comparison with ancient texts, all the resulting combinations should be sorted in alphabetical order.
rn
for example, if a word is placed on an artifact on an artifact & laquo; cat & raquo;, your program should generate and display the words & laquo; cat & raquo;, & laquo; who & raquo;, & laquo; Oct & raquo ;, & laquo; & laquo; MSW & raquo ;, & laquo; current & raquo;.
rn
& nbsp;
Input format
The word for generating permutations (string). It can be one line without spaces containing letters or numbers.
Output format
All unique rearrangements of the symbols of the input word sorted in alphabetical order. Each permutation is displayed on a new line (string).
Example
Output
DMO
House
MDO
Mod
ODM
OMD
Hint
There will be no clue here, decide for yourself!