#K72742. Sort Camera Timestamps
Sort Camera Timestamps
Sort Camera Timestamps
You are given information recorded by multiple cameras. For each camera, you are provided with the number of timestamp entries it has recorded, followed by the list of timestamps in the format YYYY-MM-DD HH:MM:SS. Your task is to sort the timestamps for each camera in ascending (chronological) order and format the output by printing a header line for each camera in the form Camera i: (where i is the camera number starting from 1), followed by the sorted timestamps, each on a new line.
Note: If there are no cameras, no output should be produced.
The timestamps sorting is based on their lexicographical order which, given the specified format, is equivalent to sorting them chronologically.
inputFormat
The input is read from standard input (stdin) and is structured as follows:
- The first line contains a single integer n representing the number of cameras.
- For each camera, the following set of lines appears:
- The first line contains an integer m representing the number of timestamp entries for that camera.
- The next m lines each contain one timestamp string in the format \(YYYY-MM-DD\ HH:MM:SS\).
You can assume that timestamps are valid and in the given format.
outputFormat
For each camera, output the following to standard output (stdout):
- A line in the format Camera i: where i is the camera number (starting from 1).
- The subsequent lines are the sorted timestamps for that camera in ascending order, one per line.
If n is 0, no output should be produced.
## sample1
1
2023-01-01 12:00:00
Camera 1:
2023-01-01 12:00:00
</p>