You are given a string with length M. You have to show all
the possible permutations of the string.
Input
You will be given a string of length M.
Output
You have to show each permutation of the string in a
new line. The order in which you output the permutations is not important.
However, you shouldn’t show repetitions
(the same permutation twice) or lines that aren’t permutations of the original
string.
Restrictions
2 ≤ M ≤ 8; The
string may contain both Latin alphabet letters or numbers.
Input
1
|
Input
2
|
AB
|
122
|
Output
1
|
Output
2
|
AB
BA
|
122
212
221
|