User's AC Ratio

100.0% (42/42)

Submission's AC Ratio

63.4% (59/93)

Description

Given two sets $S_A$ and $S_B$. If all elements in set $S_B$ are also in set $S_A$, we say that $S_B$ is a subset of $S_A$.
For example, if set $S_A=\{A,B,C,D\}$, $\{A,C\}$, $\{A\}$, $\{B,C,D\}$ are all subsets of set $S_A$.
Now please write a program that prints all subsets of given set $S_A$.

Input Format

Input contains two lines. First line of input is an integer $n$, representing the number of elements in the set $S_A$. $(1 \leq n \leq 16)$
The second line of input contains $n$ characters (letters and digits only), which are elements of the set $S_A$.

Output Format

All subsets (except for empty set) of given set $S_A$ with each subset in a line. No blank spaces are required.
You don't need to concern about the order of subsets or elements in a subset.

Sample Input 1

3
A B C

Sample Output 1

ABC
AB
AC
BC
A
B
C

Hints

Problem Source

Subtasks

No. Testdata Range Score
1 0~4 10

Testdata and Limits

No. Time Limit (ms) Memory Limit (KiB) Output Limit (KiB) Subtasks
0 1000 65536 65536 1
1 1000 65536 65536 1
2 1000 65536 65536 1
3 1000 65536 65536 1
4 1000 65536 65536 1