

Consider ‘QUERY’ = [“Coding”, “CodiNg”, “COdiNG”, “Ninja”, “CNinja”] and string ‘PATTERN’ = “CN”
Then “CN” equals “CodiNg” by inserting lowercase letters “o”, “d”, “i”, and “g” like this -: “C” + “odi” + “N” + “g” = “CodiNg”.
“CN” equals “CNinja” by inserting lowercase letters “i”, “n” “j” and “a” like this -: “CN” + “inja” = “CNinja”.
No other string in ‘QUERY’ can match with “CN” by inserting some lowercase letters.
Thus, we should return the boolean array -: [False, True, False, False, True].
The first line of input contains an integer ‘T’ denoting the number of test cases.
The first line of each test case consists of a single integer ‘N’ representing the size of the list/array ‘QUERY’.
The second line of each test case consists of ‘N’ single space-separated strings representing array ‘QUERY’.
The third line of each test case consists of a single string, ‘PATTERN’.
For each test case, print ‘N’ single space-separated strings, where the ‘i-th’ string will be “True”, if and only if ‘QUERY[i]’ matches with the ‘PATTERN’, Otherwise it will be “False”.
Print the output of each test case in a separate line.
You do not need to print anything, it has already been taken care of. Just implement the given function.
1 <= T <= 50
1 <= N <= 10^3
1 <= |QUERY[i]| <= 10^3
1 <= |PATTERN| <= 10^3
‘PATTERN’ has only lowercase or uppercase English letters.
‘QUERY[i]’ has only lowercase or uppercase English letters.
Where ‘T’ is the total number of test cases, ‘N’ is the size of the list/array ‘QUERY’, |QUERY[i]| is the maximum length of the string in ‘QUERY’ and |PATTERN| is the length of the given string ‘PATTERN’.
Time limit: 1 sec
This approach is straightforward, We one by one check for each ‘i’ whether ‘QUERY[i]’ matches ‘PATTERN’ or not using the algorithm based on two-pointers as described below.