#K54917. Parking Lot Time Calculator
Parking Lot Time Calculator
Parking Lot Time Calculator
You are provided with a parking lot event log. Each event is represented as a string in the format (HH:MM; \text{CarId}; \text{EventType}) where (\text{EventType}) is either 'enter' or 'exit'. Your task is to compute the total parking time (in minutes) for each car. Consider only events where an 'exit' occurs after a valid 'enter'. If an exit occurs without a corresponding enter, ignore that event. The program should read from standard input and write to standard output.
inputFormat
The first line contains a single integer (n) indicating the number of events. The next (n) lines each contain an event in the format: (HH:MM; CarId; EventType).
outputFormat
For each car that completes a parking cycle, output a line with the car's id and the total parking time in minutes, separated by a space. The output should be sorted in lexicographical order of CarId.## sample
2
08:00 A1 enter
12:00 A1 exit
A1 240