#K37212. Lexicographically Sorted Permutations Generator
Lexicographically Sorted Permutations Generator
Lexicographically Sorted Permutations Generator
Given a string \(s\) consisting of distinct lowercase Latin letters, generate all possible permutations of \(s\) in lexicographically sorted order. Permutations should be printed with each permutation on a new line. Use standard input (stdin) to read the input and standard output (stdout) to print the result.
The problem requires that if \(s\) is provided, then all unique arrangements of its characters are listed in increasing (dictionary) order. For example, if \(s = \texttt{ab}\), the output should be:
ab ba
Please ensure that your solution reads from stdin and writes to stdout.
inputFormat
The input consists of a single line containing the string (s), which is made up of distinct lowercase Latin letters.
outputFormat
Output each lexicographically sorted permutation of (s) on a separate line.## sample
a
a