#K13971. Check Subsequence Problem

    ID: 24031 Type: Default 1000ms 256MiB

Check Subsequence Problem

Check Subsequence Problem

Problem Description: Given two strings ( S ) and ( P ), determine whether ( P ) is a subsequence of ( S ).

A string ( P ) is said to be a subsequence of ( S ) if there exist indices ( 1 \leq i_1 < i_2 < \dots < i_{|P|} \leq |S| ) such that ( S[i_1]S[i_2]\dots S[i_{|P|}] = P ).

For each test case, output 'Yes' if ( P ) is a subsequence of ( S ), otherwise output 'No'.

inputFormat

Input Format:

The first line contains an integer ( T ), denoting the number of test cases.
Each test case consists of two lines:
- The first line contains the string ( S ).
- The second line contains the string ( P ).

outputFormat

Output Format:

For each test case, output a single line containing 'Yes' if ( P ) is a subsequence of ( S ), otherwise output 'No'.## sample

3
abcde
ace
abcde
aec
abc
abc
Yes

No Yes

</p>