#C1826. Subsequence Check

    ID: 45074 Type: Default 1000ms 256MiB

Subsequence Check

Subsequence Check

Given two strings s and t with lengths n and m respectively, determine whether t is a subsequence of s. A string t is a subsequence of s if there exists a sequence of indices \(1 \le i_1 < i_2 < \cdots < i_m \le n\) such that \( s[i_k] = t[k] \) for all \(k = 1, 2, \ldots, m\).

Your task is to read from the standard input the parameters and output "YES" if t is a subsequence of s, or "NO" otherwise.

inputFormat

The input is read from standard input and consists of four lines:

  1. The first line contains an integer n denoting the length of string s.
  2. The second line contains the string s.
  3. The third line contains an integer m denoting the length of string t.
  4. The fourth line contains the string t.

outputFormat

Print a single line to standard output containing "YES" if t is a subsequence of s, or "NO" otherwise.

## sample
7
abacaba
4
baca
YES

</p>