#C9265. Hourly Log Event Summary
Hourly Log Event Summary
Hourly Log Event Summary
Given a series of log entries, your task is to produce a summary report that counts the number of events for each hour. Each log record contains a timestamp in the format YYYY-MM-DD HH:MM:SS
followed by an event description. The input is terminated by a line containing exactly END_OF_LOGS
.
Your output should list each hour (in the format YYYY-MM-DD HH
) and the corresponding event count for that hour, sorted in ascending order of the hour. The summary for each hour must be printed in the format: YYYY-MM-DD HH: [Event Count]
. All formulas (if any) should be written in LaTeX format.
inputFormat
The input is provided via stdin and consists of multiple lines, where each line is a log entry. The log entries are in the following format:
YYYY-MM-DD HH:MM:SS Event Description
The input ends with a line containing exactly END_OF_LOGS
, which should not be processed.
outputFormat
The output is written to stdout and consists of one or more lines. Each line represents an hour and its event count, in the following format:
YYYY-MM-DD HH: [Event Count]
The lines must be sorted in ascending order of the hour.
## sample2023-04-01 14:45:23 User login
END_OF_LOGS
2023-04-01 14: 1
</p>