e-olymp
Competitions

ADA University - February 9

Permutation (2)

Given a string consisting of m (2m8) characters (Latin letters and digits). Print all permutations of symbols for this string.

Input

One string of symbols.

Output

Print all permutations for the given string in lexicographical order. Each permutation must be printed on a separate line.

Time limit 1 second
Memory limit 64 MiB
Input example #1
AB
Output example #1
AB
BA