| # | Problem | Pass Rate (passed user / total user) |
|---|---|---|
| 11894 | 電機系 DS 上機考 Santa List |
|
Description
Objective
- Use linked lists to find out the Santa list of Christmas gifts.
- Each node stores a child name and the gift
- Naughty kids can only get a lump of coal
-
Example: (Andy,paper)->(Sandy,Candy)->(David,coal)
Requirements
- SantaList will be initialized with the input at the 1st line
- AppendList
-
The gift list will be inserted in to SantaList after the existing good kids and before naughty kids.
-
You can assume no child's name repeats.
-
-
NaughtyKid
-
Naughty kids can be listed more than once, Santa Claus always move them to the end of the list one by one
-
Santa Claus will replace the gift of naughty kids with "coal"
-
You can assume the name of the listed naughty kids always exist in Santa Claus' list
-
-
Find out the final list when get the "End"
Input
Output
- Pring SantaFinalList or Empty
- List of children and their corresponding gifts (or coal)
- Connect with symbols “->”
- No space in between
- If the list is Empty, print “Empty” only.