#K90762. Ticket Reservation System
Ticket Reservation System
Ticket Reservation System
You are given a ticket reservation system that processes several commands. The commands include:
book <Name> <Event>
– to book a ticket for an event.cancel <Name> <Event>
– to cancel an existing booking.status <Event>
– to query the list of names who have booked the event.end
– indicating the end of input (this line should not be processed).
For a given event, if there are bookings, output the names in alphabetical order. If there are no bookings (i.e. when the set of bookings is empty, i.e. \(\emptyset\)), output No bookings.
Your task is to implement the system so that it processes the commands correctly and outputs the expected results for each status
command.
inputFormat
The input consists of several lines where each line represents one command. The commands can be one of the following formats:
book <Name> <Event>
cancel <Name> <Event>
status <Event>
end
– this line indicates termination of the input and should not be processed.
All input should be read from standard input (stdin).
outputFormat
For each status
command, output the list of names that have booked the event, one per line, in alphabetical order. If there are no bookings for the event, output No bookings on a single line. All output should be written to standard output (stdout).
book John Concert
book Alice Concert
book Bob Seminar
cancel John Concert
status Concert
status Seminar
cancel Alice Concert
status Concert
end
Alice
Bob
No bookings
</p>