#K69752. Filtering Log Entries Within a Time Range
Filtering Log Entries Within a Time Range
Filtering Log Entries Within a Time Range
You are given a list of log entries. Every log entry is a string containing an identifier, a timestamp in the format \( YYYY-MM-DD \; HH:MM:SS \) and a message. Your task is to filter out the log entries that have timestamps within an inclusive time range [start_time, end_time].
If no log entry falls into the given time range, output No logs found
.
The timestamp format follows the ISO standard, so the lexicographical order of the strings is the same as its chronological order.
inputFormat
The input is given via stdin and has the following format:
n start_time end_time log1 log2 ... logn
Where:
n
is an integer representing the number of log entries.start_time
andend_time
are strings in the format \( YYYY-MM-DD \; HH:MM:SS \) representing the time range (inclusive).- Each log entry is a line with an identifier, a timestamp, and a log message. The timestamp is composed of two tokens (date and time) separated by a space.
outputFormat
Output to stdout the filtered log entries, each on a separate line. If no logs are found within the time interval, output exactly No logs found
.
3
2023-01-01 10:00:00
2023-01-01 12:00:00
1 2023-01-01 09:59:59 System starting
2 2023-01-01 10:30:00 User logged in
3 2023-01-01 12:00:00 User logged out
2 2023-01-01 10:30:00 User logged in
3 2023-01-01 12:00:00 User logged out
</p>