#TP0000004. Thông điệp ẩn trong xâu (All in All)
Bài tập thuộc lộ trình
Mục lục đề ⌄
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 and . Decide whether it is possible to delete some characters from (possibly none) so that the remaining characters, read from left to right, form exactly . Such a string is called a subsequence of .
Characters must match exactly: uppercase and lowercase letters are distinct.
Input
One line contains two whitespace-separated strings and , in that order.
Output
Print exactly Yes if is a subsequence of ; otherwise print exactly No.
Subtasks
- Subtask 1 (20 points): ; ; both strings contain only ASCII letters
A–Z,a–zand digits0–9; comparisons are case-sensitive. - Subtask 2 (30 points): ; ; both strings contain only ASCII letters
A–Z,a–zand digits0–9; comparisons are case-sensitive. - Subtask 3 (50 points): ; ; both strings contain only ASCII letters
A–Z,a–zand digits0–9; comparisons are case-sensitive.
Examples
Input
abc axbcy
Output
Yes
Explanation
In the input, is abc and is axbcy. We keep the characters at positions , and of (using 1-based indexing): a, b and c. Removing x at position and y at position leaves abc. The output is therefore Yes.