#K58477. Subsequence Verification

    ID: 30651 Type: Default 1000ms 256MiB

Subsequence Verification

Subsequence Verification

Given two strings S and T, determine whether T is a subsequence of S. A string T is a subsequence of S if T can be derived from S by deleting zero or more characters without changing the order of the remaining characters.

For example, if S = "abcde" and T = "ace", then T is a subsequence of S because the characters a, c, and e appear in order. However, if T = "aec", then T is not a subsequence because the order of characters does not match that in S.

inputFormat

The input starts with a positive integer N, representing the number of test cases.

Each test case consists of two lines: the first line contains the string S and the second line contains the string T.

outputFormat

For each test case, output a single line containing "YES" if T is a subsequence of S, or "NO" otherwise.## sample

4
abcde
ace
abcde
aec
a
a
abcde
abcde
YES

NO YES YES

</p>