#C191. Filter Messages
Filter Messages
Filter Messages
Problem Statement:
You are given a list of messages and a list of keywords. Your task is to filter and output only those messages that contain at least one keyword. The filtering is case-insensitive and empty messages should be ignored.
For each message \(m\) and keyword \(k\), the message should be included in the output if \( k \) appears in the lowercase version of \(m\). In other words, if \( m_{lower} \) contains \( k \), then \( m \) is a valid message to output.
inputFormat
Input Format:
- The first line contains an integer \( n \), the number of messages.
- The next \( n \) lines each contain a message (a string, which can be empty).
- The next line contains an integer \( m \), the number of keywords.
- The following \( m \) lines each contain a keyword.
The input is read from standard input (stdin).
outputFormat
Output Format:
Output each message that contains at least one of the keywords (in a case-insensitive manner) on a new line. The order of the messages must remain the same as in the input. If no message matches, output nothing.
The output is written to standard output (stdout).
## sample4
The weather today is sunny.
I love programming in Python!
Yesterday was a rainy day.
2
sunny
python
The weather today is sunny.
I love programming in Python!
</p>