#abc349c. C - Airport Code
C - Airport Code
Score: points
问题陈述
一个由大写英文字母组成的长度为 的字符串 是由小写英文字母组成的字符串 的 机场代码,当且仅当 可以通过以下方法之一从 派生出来:
- 从 中取出长度为 的子序列(不一定是连续的),并将其转换为大写字母以形成 。
- 从 中取出长度为 的子序列(不一定是连续的),将其转换为大写字母,并在末尾添加
X
以形成 。
给定字符串 和 ,请确定 是否是 的机场代码。
以上为大语言模型 kimi 翻译,仅供参考。
Problem Statement
A string of length consisting of uppercase English letters is an airport code for a string of lowercase English letters if and only if can be derived from by one of the following methods:
- Take a subsequence of length from (not necessarily contiguous) and convert it to uppercase letters to form .
- Take a subsequence of length from (not necessarily contiguous), convert it to uppercase letters, and append
X
to the end to form .
Given strings and , determine if is an airport code for .
Constraints
- is a string of lowercase English letters with a length between and , inclusive.
- is a string of uppercase English letters with a length of .
Input
The input is given from Standard Input in the following format:
Output
Print Yes
if is an airport code for , and No
otherwise.
Sample Input 1
narita
NRT
Sample Output 1
Yes
The subsequence nrt
of narita
, when converted to uppercase, forms the string NRT
, which is an airport code for narita
.
Sample Input 2
losangeles
LAX
Sample Output 2
Yes
The subsequence la
of losangeles
, when converted to uppercase and appended with X
, forms the string LAX
, which is an airport code for losangeles
.
Sample Input 3
snuke
RNG
Sample Output 3
No