All Submissions


Given a string,you are supposed to print all its distinct anagrams in sorted order.
length of string <=10

Input contains many Strings,Read till End of File
For each input string print its distinct anagrams in sorted order,one per line
Output of 2 consequtive cases must be seperated by a newline


You can solve this very easily using next_permutation, but try not using it.
Solve it using recursion.



INPUT:

abc
aaa
baa

OUTPUT:

abc
acb
bac
bca
cab
cba

aaa

aab
aba
baa





Problem Setter: Jayant Mukherji

Languages: Brain,C,C++,Java,Pascal,Perl,PHP,Python,Ruby,Text

Time Limit: 1 Second(s)
Score: 0 Point(s)
Input File Limit: 50000 Bytes

Submit

Login to post clarification.

No Clarifications.

Contest

Mode Judge

Passive

Online

Overall Rankings

RankNameScore
1xyz0
2Ams0
3TIP0
4team420
5xyzz0
6asdasdasd0
7abcd0
8khankhan0
9Gabriel0
10gigel0