#C2446. Room Booking Checker
Room Booking Checker
Room Booking Checker
You are given a sequence of room booking requests. Each request is represented by a room identifier, which is a non-empty string. The rules for processing the requests are simple: the first time a room is requested, it is successfully booked, and any subsequent request for the same room yields an 'unavailable' status.
Formally, let \( S \) be the set of rooms that have already been booked. For each room identifier \( r \) in the sequence:
$$ \text{if } r \notin S \text{ then book } r \text{ and add it to } S, \quad \text{else output 'unavailable'} $$
Your task is to simulate this booking process and output the booking status for each request.
inputFormat
The input is read from standard input (stdin). The first line contains an integer \( N \), which represents the number of booking requests. Each of the following \( N \) lines contains a room identifier (a non-empty string).
outputFormat
For each booking request, print a line to standard output (stdout) with the booking status: print booked
if this is the first request for the room, or print unavailable
if the room has already been booked.
3
room101
room102
room101
booked
booked
unavailable
</p>