#K33452. Attendance Log Processing

    ID: 25090 Type: Default 1000ms 256MiB

Attendance Log Processing

Attendance Log Processing

You are given a sequence of log entries representing the attendance records of students in a class. Each log entry is a single command in one of the following formats:

  • Join <name> <HH:MM>: A student named name joins the class at the specified time.
  • Leave <name> <HH:MM>: The student leaves the class at the specified time.
  • Calculate <name>: Compute and output the total time the student has spent in class so far in the format HH:MM.

When a student joins and later leaves, the duration is calculated as the difference between the leave time and the join time, and this duration is added to the student’s total attendance time. If a Calculate command is issued for a student who has not been recorded or has no complete sessions, output 00:00.

The input is provided through standard input (stdin), and the output should be printed to standard output (stdout), with each result for a Calculate command on a separate line.

inputFormat

The first line of input contains an integer n representing the number of log entries. The following n lines each contain a command, which can be one of the following formats:

  • Join <name> <HH:MM>
  • Leave <name> <HH:MM>
  • Calculate <name>

All times are given in 24-hour format. The commands are processed in the order they appear.

outputFormat

For each Calculate command encountered in the log, output a line containing the total attendance time for the specified student in the format HH:MM. If the student does not have any valid attendance record, output 00:00.

## sample
3
Join Alice 09:00
Leave Alice 10:00
Calculate Alice
01:00

</p>