#K76642. Longest Activity by Day

    ID: 34688 Type: Default 1000ms 256MiB

Longest Activity by Day

Longest Activity by Day

You are given an activity log containing n entries. Each entry consists of a date, an activity description, and the duration of that activity in the format YYYY-MM-DD ActivityName - HH:MM:SS.

Your task is to determine, for each day, the activity that took the longest time. If there are activities with the same duration on the same day, choose the one that appears first in the input.

The duration is given as a time string HH:MM:SS. You can compute the total seconds of the duration using the formula: $$\text{total\_seconds} = HH \times 3600 + MM \times 60 + SS.$$

Finally, output the results in ascending order by date, one per line, where each line contains the date and the corresponding activity separated by a space.

inputFormat

The first line contains an integer n representing the number of log entries.

Each of the next n lines contains a log entry in the format:

YYYY-MM-DD ActivityName - HH:MM:SS

Note that ActivityName may consist of one or more words.

outputFormat

For each unique date (sorted in ascending order), output a line containing the date and the activity that took the longest time on that day, separated by a space.

## sample
5
2023-10-01 Reading - 02:30:00
2023-10-01 Coding - 01:45:00
2023-10-02 Meeting - 02:00:00
2023-10-02 Emails - 01:15:00
2023-10-01 Jogging - 00:45:00
2023-10-01 Reading

2023-10-02 Meeting

</p>