#C10981. Subsequence Checker

    ID: 40246 Type: Default 1000ms 256MiB

Subsequence Checker

Subsequence Checker

Given two strings s1 and s2, determine whether s2 is a subsequence of s1. A string s2 is considered a subsequence of s1 if it can be derived by deleting zero or more characters from s1 without changing the order of the remaining characters. More formally, if \[ s1 = a_1a_2 \ldots a_n \quad \text{and} \quad s2 = b_1b_2 \ldots b_m, \] then s2 is a subsequence of s1 if there exist indices satisfying \[ 1 \le i_1 < i_2 < \cdots < i_m \le n \quad \text{such that} \quad a_{i_j} = b_j \; \text{for all} \; 1 \le j \le m. \]

Output YES if s2 is a subsequence of s1, otherwise output NO.

inputFormat

The input consists of two lines. The first line contains the string s1 and the second line contains the string s2.

outputFormat

Output a single line with either YES if s2 is a subsequence of s1 or NO otherwise.

## sample
abcde
ace
YES

</p>