#K7396. String Transformation Check

    ID: 34091 Type: Default 1000ms 256MiB

String Transformation Check

String Transformation Check

You are given two strings: a source string and a target string. Your task is to determine whether the target string can be obtained from the source string by deleting zero or more characters without changing the order of the remaining characters. In other words, check if the target is a subsequence of the source.

Formally, let the source string be \(S = s_1s_2\dots s_n\) and the target string be \(T = t_1t_2\dots t_m\). The target is a subsequence of the source if there exist indices \(1 \le i_1 < i_2 < \dots < i_m \le n\) such that \(s_{i_j} = t_j\) for every \(1 \le j \le m\).

inputFormat

The input is read from standard input (stdin) and consists of exactly two lines:

  1. The first line contains the source string.
  2. The second line contains the target string.

outputFormat

Print to standard output (stdout) a single line containing YES if the target string is a subsequence of the source string, or NO otherwise.

## sample
abcde
abc
YES