#K85322. String Permutations
String Permutations
String Permutations
Given a string s consisting of distinct characters, generate all its permutations. A permutation is an arrangement of all the characters in the string. The total number of permutations is given by \(n!\) where \(n\) is the length of the string.
Your task is to output all the permutations in lexicographical order, with each permutation printed on a new line.
inputFormat
The input consists of a single line containing the string s
composed of letters only.
outputFormat
Output all the distinct permutations of s
in lexicographical order. Each permutation should be printed on a separate line.
a
a
</p>