Problem1063--All possible strings

1063: All possible strings

[Creator : ]
Time Limit : 1.000 sec  Memory Limit : 128 MiB

Description

Given a string S with N characters (N<8), please output all the possible string after re-arrange the 
order of the string. For example, given S="abcc", then output:
abcc
acbc
accb
bacc
bcac
bcca
cabc
cacb
cbac
cbca
ccab
ccba
Please output in ascending order!

Input

one line with the string S

Output

all the possible strings in ascending order, one line one string!

Sample Input Copy

abcc

Sample Output Copy

abcc
acbc
accb
bacc
bcac
bcca
cabc
cacb
cbac
cbca
ccab
ccba

Source/Category