Problem of the day
1. The input string may contain the same characters, so there will also be the same permutations.
2. The order of permutation does not matter.
The first and only line of input contains a string 'S' of alphabets in lower case characters.
Print all the permutations of the given string 'S' in a separate line.
You do not need to print anything, it has already been taken care of. Just implement the given function.
0 <= |S| <= 8
Where |S| denotes the length of string 'S'.
Time limit: 1 sec
cba
abc
acb
bac
bca
cab
cba
All the possible permutations for string "cba" will be "abc", "acb", "bac", "bca", "cab" and "cba".
xyx
xyx
xxy
yxx
yxx
xyx
xxy
All the possible permutations for string "xyx" will be "xyx", "xxy", "yxx", "yxx", "xyx" and "xxy". Here, all three permutations "xyx", "yxx", "xxy" are repeating twice but we need to print all the possible permutations and hence we are printing them twice..