HomeVolumesContestsSectionsForumsUsersPrintHelpAbout

Volumes > Camp. Turkey > problem:


Permutations

Volume problems

• Workshop
• City Tour
• A Palace with Many Columns
• Nameplates
• Cycle detection
• Cities and roads
• Adjacency matrix to edges list
• Edges list to Adjacency matrix
• Permutations
• Reverse permutation
• Divisors count
• GCD of ones
• Set cover problem
• Subsets
• The N Queens Problem
• Maximum Sum 2
• Gifts of Santa Claus

Feedback

If you notice incorrect translations in Contester, please let author know.

Time limit 1000/1000/1000/1000 ms. Memory limit 65000/65000/65000/65000 Kb.

Problem description

You are given a string of N characters. Find all distinct permutations of this string in increasing order.

Input

1 string of N characters where 1<=N<=8.

Output

Write all distinct permutations.

Example

stdin stdout

AB

AB
BA

212

122
212
221

Для отправки решений необходимо выполнить вход.

www.contester.ru