2908 - I2P(I)2023_Hu_Lab9 Scoreboard

Time

2023/12/04 20:30:00 2023/12/04 20:31:00

Clarification

# Problem Asker Description Reply Replier Reply Time For all team

# Problem Pass Rate (passed user / total user)
14134 Strawhats' Bento Set
14153 Fire Fist Ace

14134 - Strawhats' Bento Set   

Description

The Strawhats are departing Wano! 

Sanji is preparing bentos with a set of ingredients I.

He plans to make each bento with the set of all subsets of I, including I itself.

Chopper needs to list all the bento sets that Sanji is going to make. 

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 Ingredients 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 the given specific set of ingredients.

Input

The stringthat can be viewed as a set. (4 < the length of < 21)

Output

Output the bento sets followed by a newline character at the end of each set

Sample Input  Download

Sample Output  Download

Tags




Discuss




14153 - Fire Fist Ace   

Description

Remember to print the result in your function.c as the printf part is commented on the partial judge code.

Robin stumbled arcross split poneglyphs on a ship, but she still couldn't understand the meaning behind them.

Ace, Luffy's brother, came to the ship and noticed the split poneglyphs.

He demonstrated to Robin with his fire fist that by splitting the string into words and sorting the alphabet in each word in decreasing order based on character frequency, a hidden clue could be revealed.

The rules to sort the characters in the string are:

- Sort the characters by how frequently they appear in the string. If they appear more frequently, they should come first.

- If the frequency of characters is the same, sort it by the type, namely from uppercases  > lowercases > digits.

- If the type is also the same, sort uppercase and lowercase characters in dictionary order, and sort digits in increasing order.

Take the string "IxyzamxyzluffyxyzaAbb54xyztree" for example. If it were to be split using the delimiter "xyz", the set of words from the splitting process is ["I", "am", "luffy", "aAbb54", "tree"].

After sorting each alphabet in the words, we obtain ['I', 'am', 'ffluy','bbAa45', 'eert'].

Explanation:

 "aAbb54" -> "bbAa45"

 'b' appears twice while 'a', 'A', '5', and '4' appear once. So 'b' must appear before 'a', 'A', '5', and '4'. Next, since the order of precedence is uppercase letters > lowercase letters > digits, 'A' must appear before 'a', '5', and '4', and 'a' must appear before '5' and '4'. Finally since '5' and '4' have the same frequency then sort it by increasing order.

"tree" -> "eert"

 'e' appears twice while 'r' and 't' both appear once. So 'e' must appear before both 'r' and 't'. And 'r' is before 't' since it is like so in dictionary order

ps: you should print by yourself at the sort function

Input

The first line contains a string that should be split, 20 ≤ the length of ≤ 499

The second line is the delimiter string P, 1 ≤ the length of ≤ 9.

Output

Output the sorted strings splited by the given pattern.

Don't forget to include '\n' at the end of each output string.

 

Sample Input  Download

Sample Output  Download

Partial Judge Code

14153.c

Partial Judge Header

14153.h

Tags




Discuss