HomeVolumesContestsSectionsForumsUsersPrintHelpAbout

Volumes > Camp. Turkey > problem:


Subsets

Volume problems

• 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
• Shopping
• Diameter of graph
• Corridor
• Prime numbers
• Rectangles on a plane

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