#K84472. Nightclub Security Log

    ID: 36427 Type: Default 1000ms 256MiB

Nightclub Security Log

Nightclub Security Log

In this problem, you are tasked with maintaining a log for a nightclub security system. The system records the entry and exit operations of visitors. Each operation is represented by a string in the format (\texttt{enter X}) or (\texttt{exit X}), where (X) is the visitor's identifier (an integer). If an exit operation is recorded for a visitor who is not currently inside, an error must be logged. Your task is to output all error logs (each occurrence as simply the string (\texttt{error})) in the order they occur, followed by the number of visitors still inside the nightclub. The input is given from standard input (stdin) and the output should be written to standard output (stdout).

inputFormat

The first line of input contains a single integer (n) representing the number of operations. The following (n) lines each contain an operation in one of the following forms: (enter\ X) or (exit\ X), where (X) is an integer representing the visitor's identifier.

outputFormat

If there are any error logs, print each occurrence of (\texttt{error}) on a separate line in the order of occurrence, followed by a line containing a single integer representing the number of visitors remaining in the nightclub. If there are no error logs, only the visitor count is printed.## sample

6
enter 1
enter 2
exit 1
exit 4
enter 2
exit 2
error

0

</p>