eolymp
Problems

Permutation of letters

Permutation of letters

Given a string consisting of m symbols. Print all permutations of symbols for this string.

Input

One string consisting of m (2m8) of symbols - Latin letters and digits.

Output

Print all permutations for the given string in lexicographical order.

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