#C3296. Contiguous Subsequence Check
Contiguous Subsequence Check
Contiguous Subsequence Check
This problem requires you to determine whether a given string s is a contiguous subsequence (i.e., a substring) of any row in a two-dimensional grid of characters.
You are given a grid with n rows and m columns. Each row of the grid is represented by a string of length m. The task is to check whether the string s appears as a contiguous block of characters in at least one of the rows.
Note that by definition, an empty string is considered a substring of any string. In mathematical terms, if we denote the grid rows by \(R_i\) for \(i = 1,2,\dots,n\), then you must output "Yes" if there exists an \(i\) such that \[ s \subset R_i \] holds (using the \(\subset\) as a loose notation for substring), and "No" otherwise.
inputFormat
The input is read from stdin and has the following format:
n m row_1 row_2 ... row_n s
Here, n and m are integers representing the number of rows and the number of characters in each row respectively. row_1 to row_n are the rows of the grid, and s is the string to be checked.
outputFormat
The output should be a single line to stdout containing either "Yes" if the string s is a contiguous subsequence of any row of the grid, or "No" otherwise.
## sample3 3
abc
def
ghi
abc
Yes