#C11394. Log Message Counter

    ID: 40705 Type: Default 1000ms 256MiB

Log Message Counter

Log Message Counter

You are given a list of log entries and a query string. Each log entry is provided in the format timestamp,message_type, where timestamp is in the format \(YYYY-MM-DD\ HH:MM:SS\) and message_type is a string.

The query string is given in the format start_timestamp,end_timestamp,message_type, where start_timestamp and end_timestamp define a time interval and message_type is the type of log messages to count.

Your task is to count how many log entries have a timestamp that lies within the given time interval (inclusive) and whose message type matches the one specified in the query.

You may assume that all timestamps follow the format \(YYYY-MM-DD\ HH:MM:SS\) and that lexicographical order is consistent with chronological order.

inputFormat

The input is read from standard input (stdin) with the following format:

N
log_entry_1
log_entry_2
... 
log_entry_N
query

Here, N is an integer representing the number of log entries. Each log_entry is a string in the format timestamp,message_type. The final line is the query string in the format start_timestamp,end_timestamp,message_type.

outputFormat

The output is a single integer printed to standard output (stdout) representing the count of log messages that match the given criteria.

## sample
4
2023-01-01 10:15:30,ERROR
2023-01-01 11:20:45,INFO
2023-01-01 10:30:00,ERROR
2023-01-01 10:45:00,DEBUG
2023-01-01 10:00:00,2023-01-01 11:00:00,ERROR
2