#K74697. Filter Messages by Time Range
Filter Messages by Time Range
Filter Messages by Time Range
You are given a list of messages, each with an associated timestamp, and a time interval defined by two integers start_time and end_time. Your task is to filter and print only those messages whose timestamps satisfy the inequality: \( start\_time \leq t \leq end\_time \).
If there are no messages within the provided range, output "No messages found".
inputFormat
The input is given via standard input in the following format:
- An integer
n
representing the number of messages. n
lines follow. Each of these lines contains a message and its timestamp separated by a comma. Note: The message will not contain any commas.- The last line contains two integers
start_time
andend_time
separated by a space.
outputFormat
If any messages fall within the time range (inclusive), print each valid message on its own line in the order they appear in the input.
If no message satisfies the condition, print exactly:
No messages found## sample
5
Hello there!,100
How are you?,200
Let's meet at 3 PM,300
See you later,400
Goodbye,500
150 400
How are you?
Let's meet at 3 PM
See you later
</p>