Generate All Subsequences of a String
Generate all possible subsequences (the power set) of a given array or string.
Input format
A single line containing a lowercase string (length ≤ 10).
Output format
Print every distinct non-empty subsequence on its own line, sorted lexicographically.
Constraints
- Values fit in a 64-bit signed integer
- Trailing whitespace and a trailing newline are ignored by the judge
Read from stdin, write to stdout. Sample cases below show the exact format.
Sample cases
Example 1
Input
abcExpected output
a
ab
abc
ac
b
bc
cExample 2
Input
aaExpected output
a
aa