Print All Permutations of a String
You are given a string and you are asked to create a recursive function to generate and print all the permutations of the characters in the string. A permutation of a string is defined as a rearrangement of its characters.
The only line of the input contains the string
s
.The output of the program should be all the permutations of the characters in the string
s
. Each permutation should be printed on a new line. The order of permutations does not matter.Input | Output |
abc | abc
acb
bac
bca
cab
cba |
Constraints
Time limit: 2 seconds
Memory limit: 512 MB
Output limit: 10 MB