#C14012. Log Analysis Report

    ID: 43615 Type: Default 1000ms 256MiB

Log Analysis Report

Log Analysis Report

You are given a list of log entries. Each log entry is a string containing a timestamp and some event details. The timestamp is in the format \(\texttt{%Y-%m-%d %H:%M:%S}\), followed by a space and then the event message.

Your task is to generate a summary report for a given time interval. In the report, count the number of log entries (within the interval, inclusive) that contain one of the following keywords in their event details: ERROR, WARNING, or INFO.

If a log entry is invalid (i.e. does not conform to the expected format), it should be skipped.

Note: The comparison of timestamps is done using the provided format and is inclusive of the boundaries.

inputFormat

Standard input (stdin) contains the following:

  1. An integer \(N\) representing the number of log entries.
  2. Next \(N\) lines, each line is a log entry. Each entry is expected to have a timestamp in the format %Y-%m-%d %H:%M:%S followed by a space and event details.
  3. A line containing the start time of the interval (in the same format).
  4. A line containing the end time of the interval (in the same format).

Example:

5
2023-05-15 10:15:53 ERROR Disk space low
2023-05-15 10:15:54 INFO User logged in
2023-05-15 10:16:10 WARNING High memory usage
2023-05-15 10:17:15 ERROR Failed to connect to server
2023-05-15 10:18:20 INFO User logged out
2023-05-15 10:15:54
2023-05-15 10:18:20

outputFormat

Standard output (stdout) should contain three lines:

  1. First line: count of log entries whose event details contain the keyword ERROR.
  2. Second line: count of log entries whose event details contain the keyword WARNING.
  3. Third line: count of log entries whose event details contain the keyword INFO.

Only the log entries with valid formats and timestamps within the given interval (inclusive) are considered.

## sample
5
2023-05-15 10:15:53 ERROR Disk space low
2023-05-15 10:15:54 INFO User logged in
2023-05-15 10:16:10 WARNING High memory usage
2023-05-15 10:17:15 ERROR Failed to connect to server
2023-05-15 10:18:20 INFO User logged out
2023-05-15 10:15:54
2023-05-15 10:18:20
1

1 2

</p>