#C4175. Subsequence Verification

    ID: 47684 Type: Default 1000ms 256MiB

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:

  1. The first line contains the string S.
  2. 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.

## sample
3
abcdefgh
ace
computer
pot
hello
world
YES

NO NO

</p>