#K43177. Subsequence Checker

    ID: 27252 Type: Default 1000ms 256MiB

Subsequence Checker

Subsequence Checker

Given two strings s and t, 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\) (where \(n = |s|\) and \(m = |t|\)) such that \(s_{i_1} = t_1, s_{i_2} = t_2, \dots, s_{i_m} = t_m\). In simpler terms, all characters of t appear in s in the same order, though not necessarily contiguously.

The input consists of two lines: the first line is s and the second line is t. The output should be YES if t is a subsequence of s and NO otherwise.

inputFormat

The input is given via standard input (stdin) and consists of two lines:

  1. The first line contains the string s.
  2. The second line contains the string t.

outputFormat

Output a single line to standard output (stdout), which is either YES or NO depending on whether t is a subsequence of s.

## sample
abcde
ace
YES