Skip to main content
Tuesday (24.11.2026) at 20:00: ALGOR Contest: Round #4 (Special Challenge) starts!

~/algor $ cat problems/ikki-korsatkich-qism-ketma-ketlik

Is it a subsequence?

Easy 1000 ms 128 MB 33%
Share

Two strings $s$ and $t$ are given. Can $s$ be obtained by deleting some letters from $t$ (possibly none) without changing the order of the rest? For example, the string abc can be obtained from ahbgdc, but axc cannot. If it can, print YES, otherwise NO.

Letters of two strings: the letters of the first string are found in order in the second and joined by lines

Input

The first line contains $s$, the second line contains $t$.

Output

YES or NO.

Note

$1 \le |s|, |t| \le 10^{5}$
the strings consist of lowercase Latin letters

Examples

Input #1
abc
ahbgdc
Output #1
YES
Input #2
axc
ahbgdc
Output #2
NO

Sign in to submit a solution

Signing up is free and takes a minute.