#C11986. Log Entry Sorting

    ID: 41362 Type: Default 1000ms 256MiB

Log Entry Sorting

Log Entry Sorting

You are given multiple log entries, each starting with a timestamp in the format \(YYYY-MM-DD HH:MM:SS\) followed by a descriptive message. Your task is to sort these log entries in ascending order based on their timestamps. If two or more log entries share the same timestamp, you must preserve their original order as they appeared in the input (i.e., perform a stable sort).

The input will be read from standard input and the sorted log entries should be printed to standard output, one per line.

inputFormat

The input consists of multiple lines. Each line represents a log entry beginning with a timestamp formatted as (YYYY-MM-DD HH:MM:SS) (always exactly 19 characters), followed by a space and then an event description.

outputFormat

Print the sorted log entries to standard output. Each line should contain one log entry. The entries must be sorted in ascending order by their timestamps. Log entries with identical timestamps must retain their original input order.## sample

2023-01-05 14:30:15 User logged in
2023-01-05 14:30:20 File uploaded
2023-01-05 14:30:15 User opened settings
2023-01-05 14:32:10 User logged out
2023-01-05 14:30:15 File deleted
2023-01-05 14:30:15 User logged in

2023-01-05 14:30:15 User opened settings 2023-01-05 14:30:15 File deleted 2023-01-05 14:30:20 File uploaded 2023-01-05 14:32:10 User logged out

</p>