!!! Prof. Hu said to learn this problem !!!
Mechanism:
Ideas:
Take example, the set of Ingredients 1
Ingredients 1 = {'Rice','Salmon'}
Then, the bento sets he is going to make are {{'Rice'},{'Salmon'},{'Rice','Salmon'}
Here is another example set of ingredients 2
Ingredients 2 = {'Rice','Seaweed','Meat'}
Then the bento sets he is going to make are {{'Rice'},{'Seaweed'},{'Rice','Seaweed'},{'Meat'},{'Rice','Meat'},{'Seaweed','Meat'},{'Rice','Seaweed','Meat'}}
But Chopper is too lazy to write all the ingredients… So he decided to label everything into a single number or alphabet!!
The set of Ingredients 1 becomes {'1','2'}
and the bento sets are {{'1'},{'2'},{'1','2'}}
The set of Inredients 2 becomes {'1','2','a'}
and the bento sets are {{'1'},{'2'},{'1','2'},{'a'},{'1','a'},{'2','a'},{'1','2','a'}}
Now help Chopper list the bento sets by given a aspecific set of ingredients.
TLDR: 3a1 => 3, a, 1, 3a, a1, 31, 3a1 (but in ordered seq)
Input:
String I that can be viewed as a setlength of I , 4 < I < 21
Output:
Output the bento sets followed by a newline character at the end of each set
Sample:
3a1
Result:
3
a
3a
1
31
a1
3a1
Optimization by LewiSC