#K58947. Subsequence Check

    ID: 30755 Type: Default 1000ms 256MiB

Subsequence Check

Subsequence Check

Given two strings S and T, determine whether S is a subsequence of T. A string S is considered a subsequence of T if all characters of S appear in T in the same order (not necessarily consecutively). For example, if S = abc\texttt{abc} and T = ahbgdc\texttt{ahbgdc}, then S is a subsequence of T, so the answer is "Yes". However, if S = axc\texttt{axc} and T = ahbgdc\texttt{ahbgdc}, then the answer is "No".

Note: An empty string is considered a subsequence of any string.

This problem tests your understanding of the two-pointer technique.

inputFormat

The input consists of two lines. The first line contains the string S, and the second line contains the string T.

outputFormat

Output a single line: "Yes" if S is a subsequence of T, otherwise "No".## sample

abc
ahbgdc
Yes