LogiQuest

123. Valid Interleaving

HardDynamic Programming

Print YES if c is formed by interleaving a and b (keeping the order of characters from each), else NO.

Input format

Line 1: a Line 2: b Line 3: c (each line contains at least one letter)

Output format

YES or NO

Example 1

Input

aabcc
dbbca
aadbbcbcac

Output

YES

Example 2

Input

aabcc
dbbca
aadbbbaccc

Output

NO

Constraints

1 ≤ |a|, |b| ≤ 100

Read input from standard input and print the answer to standard output. Your code is judged against 5 test cases, most of them hidden.

Loading the MyLoginn IDE…