#C14143. Find Substring Matches
Find Substring Matches
Find Substring Matches
You are given a list of strings and a pattern string. Your task is to search for the given pattern as a substring in each string from the list. If a string contains the given substring, print it. Otherwise, if no string in the list contains the substring, output "No match found".
The problem can be mathematically formulated as follows:
Given a list $\mathcal{S} = [s_1, s_2, \dots, s_n]$ and a substring $p$, find all $s_i$ such that $$p \subseteq s_i.$$ If none exists, return "No match found".
inputFormat
The input is read from stdin and has the following format:
- The first line contains an integer n, the number of strings.
- The next n lines each contain one string.
- The last line contains the substring pattern to search for.
outputFormat
If one or more strings contain the substring, output each matching string on a separate line to stdout. If none of them match, output exactly "No match found".
## sample3
hello
world
hello world
hello
hello
hello world
</p>