#K13836. Longest Parking Duration Vehicle

    ID: 24001 Type: Default 1000ms 256MiB

Longest Parking Duration Vehicle

Longest Parking Duration Vehicle

You are given a list of parking records for vehicles. Each record includes the vehicle's license plate, its entry time, and its exit time in the format HH:MM. Your task is to determine which vehicle stayed in the parking lot for the longest duration.

For each vehicle, compute the duration using the formula: $$\text{duration} = \text{exit time} - \text{entry time}$$ where the time is provided in the 24-hour clock HH:MM format. In case of ties, the vehicle that appears first in the input should be selected.

Note: The input is read from stdin and the output (the license plate of the vehicle with the longest parking duration) should be printed to stdout.

inputFormat

The first line of input contains an integer n indicating the number of parking records.

Then follow n lines, each containing three items separated by spaces:

  • A string representing the vehicle's license plate.
  • The entry time in HH:MM format.
  • The exit time in HH:MM format.

Example:

5
ABC123 08:00 09:30
XYZ789 07:00 09:00
LMN456 10:15 12:00
DEF000 09:45 11:30
GHI111 07:30 08:45

outputFormat

Output a single line containing the license plate of the vehicle that stayed the longest in the parking lot. The result is printed to stdout.

Example:

XYZ789
## sample
5
ABC123 08:00 09:30
XYZ789 07:00 09:00
LMN456 10:15 12:00
DEF000 09:45 11:30
GHI111 07:30 08:45
XYZ789