#K37157. Current Borrowed Books

    ID: 25914 Type: Default 1000ms 256MiB

Current Borrowed Books

Current Borrowed Books

You are given a log of actions on books in a library. Each action is recorded as a string in one of the two following formats:

  • B x: Book with ID \(x\) is borrowed.
  • R x: Book with ID \(x\) is returned (if it was previously borrowed).

Your task is to determine which books are still borrowed after processing all logs. The output should be the list of book IDs currently borrowed, sorted in ascending order. If no books are currently borrowed, output an empty line.

Note: The input is provided via standard input (stdin) and the output should be printed to standard output (stdout). Use the following input format for your program.

inputFormat

The first line of input contains an integer \(n\) representing the number of log entries. Each of the next \(n\) lines contains a log entry in the format "B x" or "R x", where "B" stands for borrowing a book and "R" stands for returning a book, and \(x\) is a positive integer representing the book ID.

outputFormat

Print a single line containing the IDs of the books currently borrowed, separated by a single space, in ascending order. If no book is borrowed, print an empty line.

## sample
5
B 1
B 2
R 1
B 3
B 2
2 3

</p>