#C6644. Employee Work Hours Calculation

    ID: 50427 Type: Default 1000ms 256MiB

Employee Work Hours Calculation

Employee Work Hours Calculation

You are given a log of entries representing employees clocking in and out during a workday. Each log entry is a string consisting of an employee ID, an action (entry or exit), and a timestamp in the HH:MM 24-hour format. For each employee, the total work duration is computed by summing up the differences between each corresponding exit and entry time. Mathematically, the total work duration is calculated as

$$\text{Total Time} = \sum (\text{exit time} - \text{entry time}) $$

Output the result for each employee in the order of their first appearance. Each result should be printed in the format: employeeID HH:MM, where HH:MM represents the total work hours.

inputFormat

The input is read from standard input (stdin) and has the following format:

  • The first line contains an integer n representing the number of log entries.
  • The following n lines each contain a log entry in the format: employeeID action time, where action is either entry or exit and time is in the HH:MM format.

outputFormat

For each employee (in order of their first appearance in the log), print a line containing the employee ID followed by their total work duration in the format HH:MM. The output is printed to standard output (stdout).

## sample
2
emp01 entry 09:00
emp01 exit 17:00
emp01 08:00

</p>