#K83982. Unique Permutations of a String

    ID: 36318 Type: Default 1000ms 256MiB

Unique Permutations of a String

Unique Permutations of a String

Given a string ( s ) consisting of uppercase or lowercase letters, your task is to list all unique permutations of ( s ) in lexicographical order.

For example, if ( s = \texttt{abc} ), the expected output is:

abc
acb
bac
bca
cab
cba

Make sure your program reads input from standard input (stdin) and prints the output to standard output (stdout).

inputFormat

A single line containing the string ( s ). The string consists of letters.

outputFormat

Print each unique permutation on a separate line, sorted in lexicographical order.## sample

abc
abc

acb bac bca cab cba

</p>