12072 - Full permutation   

Description

Given a string s, find out all the different permutations of s. (including s itself)

 

Input

Input consists of one line, containing a string s.

There will be only lowercase Latin characters in s.

Note that the characters in s might be duplicate!


The length of s is no more than 10.

Note:

There are 3 test cases for no duplicate input, and 3 for duplicate input!

 

Hint:

1. Use a visited array to record if a character of the string has been used.

2. At each subproblem, use a loop to check each character from the first to the last to see if it has been visited or can be used in the current place.

 

 

Output

Print out all possible permutations in alphabetical order, each in one line.

Note: remember to print a '\n' at the end of output.

 

Sample Input  Download

Sample Output  Download

Tags




Discuss