| # | Problem | Pass Rate (passed user / total user) |
|---|---|---|
| 11890 | Santa List |
|
Description
Objective
⁍ 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
⁍ Examples:
(Andy,paper)->(Sandy,Candy)->(David,coal)
Requirements
⁍ SantaList will be initialized with the input at the first line
⁍ AppendList: The gift list can be appended (good kids should be placed before naughty kids)
◦ Assuming no child's name repeat.
◦ Only naughty kids will get "coal". (In other words, "coal" will not appear in SantaList and AppendList)
⁍ NaughtyKid: He will check the naughty list and get names one by one
◦ Each naughty kid’s gift will be replaced with coal and move to the end of the list.
◦ Naughty kids can be named many times, and each time they are moved to the end of the list.
⁍ You should find out the final Santa List
Input
⁍ The last line of input is "End", and we only need to print the result when get the "End".
Input format:
<command> <n> < data (or data pair) repeat n times>
n is an integer and n ≥ 0

Output
⁍ First line: Empty or SantaFinalList
⁍ Second line: List of children and their corresponding gifts (or coal)
◦ If it's Empty, only need to print the first line.
◦ Connect with symbols "->"
◦ No space in between
