#C9516. Log Analyzer

    ID: 53618 Type: Default 1000ms 256MiB

Log Analyzer

Log Analyzer

You are given a series of log entries. Each log entry contains a timestamp and a message separated by a comma and a space. Your task is to analyze the logs and output three statistics:

  • Total number of logs.
  • The earliest and the latest timestamp (formatted as $\texttt{\text{earliest} \; \text{latest}}$ with a single space between them).
  • The most frequent log message.

If there are no logs, output 0 for the count and empty strings for the timestamps and the message.

Note: In case of a tie for the most frequent message, output the one that appears first in the input order.

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 following format:

timestamp, message

Here, timestamp is in the format YYYY-MM-DD HH:MM:SS and message is a string that can contain spaces.

outputFormat

Output three lines:

  1. The total number of logs.
  2. A single line with the earliest and latest timestamps separated by a single space.
  3. The most frequent log message.

If there are no logs, print 0 on the first line and print empty lines for the second and third lines.

## sample
5
2023-01-01 12:00:00, error in module
2023-01-01 12:05:00, user login
2023-01-01 12:10:00, error in module
2023-01-01 12:15:00, system shutdown
2023-01-01 12:20:00, error in module
5

2023-01-01 12:00:00 2023-01-01 12:20:00 error in module

</p>