#C6144. Subsequence Formation

    ID: 49872 Type: Default 1000ms 256MiB

Subsequence Formation

Subsequence Formation

Given two strings s and t, determine whether t can be formed from s by deleting some (possibly zero) characters without changing the relative order of the remaining characters.

This is equivalent to checking if t is a subsequence of s. In mathematical terms, there exists an increasing sequence of indices \(i_1, i_2, \dots, i_k\) such that:

\(s_{i_1} s_{i_2} \cdots s_{i_k} = t\)

Output YES if it is possible, otherwise output NO.

inputFormat

The input consists of two lines:

  • The first line contains the string s.
  • The second line contains the string t.

outputFormat

Output a single line with YES if t is a subsequence of s, otherwise output NO.

## sample
abcde
ace
YES

</p>