PHƯỚC HƯNG OJ · THỬ THÁCH THUẬT TOÁN

#TP0000004. Thông điệp ẩn trong xâu (All in All)

HỌC THEO LỘ TRÌNH

Bài tập thuộc lộ trình

1 lộ trình

Thông điệp ẩn trong xâu (All in All)

All in All

Source: UVa

Version: Phuoc Hung OJ Extended

Problem Statement

A message has been hidden inside a longer string by inserting additional characters into it. The original characters remain in their original relative order; they are not required to be adjacent.

You are given two nonempty strings ss and tt. Decide whether it is possible to delete some characters from tt (possibly none) so that the remaining characters, read from left to right, form exactly ss. Such a string ss is called a subsequence of tt.

Characters must match exactly: uppercase and lowercase letters are distinct.

Input

One line contains two whitespace-separated strings ss and tt, in that order.

Output

Print exactly Yes if ss is a subsequence of tt; otherwise print exactly No.

Subtasks

  • Subtask 1 (20 points): 1≤∣s∣,∣t∣≤2000001\le |s|,|t|\le 200000; ∣s∣+∣t∣≤14|s|+|t|\le 14; both strings contain only ASCII letters A–Z, a–z and digits 0–9; comparisons are case-sensitive.
  • Subtask 2 (30 points): 1≤∣s∣,∣t∣≤2000001\le |s|,|t|\le 200000; ∣s∣+∣t∣≤120|s|+|t|\le 120; both strings contain only ASCII letters A–Z, a–z and digits 0–9; comparisons are case-sensitive.
  • Subtask 3 (50 points): 1≤∣s∣,∣t∣≤2000001\le |s|,|t|\le 200000; ∣s∣+∣t∣≤400000|s|+|t|\le 400000; both strings contain only ASCII letters A–Z, a–z and digits 0–9; comparisons are case-sensitive.

Examples

Input

abc axbcy

Output

Yes

Explanation

In the input, ss is abc and tt is axbcy. We keep the characters at positions 11, 33 and 44 of tt (using 1-based indexing): a, b and c. Removing x at position 22 and y at position 55 leaves abc. The output is therefore Yes.