#C4175. Subsequence Verification
Subsequence Verification
Subsequence Verification
Given two strings S and P, determine whether P is a subsequence of S.
A string P is a subsequence of S if there exists an increasing sequence of indices \(i_1, i_2, \ldots, i_k\) such that \(P[j] = S[i_j]\) for all \(1 \leq j \leq |P|\). Otherwise, output 'NO'.
inputFormat
The input begins with an integer T representing the number of test cases. For each test case, there are two lines:
- The first line contains the string S.
- The second line contains the string P.
outputFormat
For each test case, output a single line with either YES
if P is a subsequence of S, or NO
otherwise.
3
abcdefgh
ace
computer
pot
hello
world
YES
NO
NO
</p>