HomeVolumesContestsSectionsForumsUsersPrintHelpAbout

Volumes > Camp. Turkey > problem:


Subsets

Volume problems

• A Palace with Many Columns
• A+B
• Herons
• City Tour
• Workshop
• The N Queens Problem
• Subsets
• Maximum Sum 2
• Gifts of Santa Claus
• Rectangles on a plane
• Permutations
• Reverse permutation
• Nameplates
• Adjacency matrix to edges list
• Edges list to Adjacency matrix

Feedback

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

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

Problem description

Make a program that generates all the subsets of a strings set S. Concatenate the members of each subset and print them lexicographic order.

Input

The first line of the input contains an integer N (1<= N <= 20) representing size of the S. Each of the following N lines contain a string (at most 20 letters) consists of English lowercase letters.

Output

Each of the output contains a concatenated subset of S in lexicographic order.

Example

stdin stdout

3
bba
a
abc

a
aabc
aabcbba
abba
abc
abcbba
bba

4
ab
aab
a
b

a
aaab
aaabab
aaababb
aaabb
aab
aabab
aababb
aabb
ab
abb
b

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

www.contester.ru