#abc268b. B - Prefix?

B - Prefix?

Score : 200200 points

问题描述

给定两个由小写英文字母组成的字符串 SSTT。判断 SS 是否为 TT 的前缀。

何为前缀?对于长度为 NN 的字符串 T1T2TNT_1T_2\ldots T_N,其前缀是一个字符串,表示为 TT 的前 ii 个字符 T1T2TiT_1T_2\ldots T_i,其中 ii 是一个整数,满足 0iN0 \leq i \leq N。例如,当 T=T = abc 时,TT 有四个前缀:空字符串、a、ab 以及 abc。

以上为通义千问 qwen-max 翻译,仅供参考。

Problem Statement

You are given two strings SS and TT consisting of lowercase English letters. Determine if SS is a prefix of TT.

What is a prefix? A prefix of a string T1T2TNT_1T_2\ldots T_N of length NN is a string expressed as the first ii characters of TT, T1T2TiT_1T_2\ldots T_i, where ii is an integer such that 0iN0 \leq i \leq N. For example, when T=T = abc, there are four prefixes of TT: an empty string, a, ab, and abc.

Constraints

  • SS and TT are strings of lengths between 11 and 100100 (inclusive) consisting of lowercase English letters.

Input

Input is given from Standard Input in the following format:

SS

TT

Output

Print Yes if SS is a prefix of TT; print No otherwise. Note that the judge is case-sensitive.

Sample Input 1

atco
atcoder

Sample Output 1

Yes

atco is a prefix of atcoder. Thus, Yes should be printed.

Sample Input 2

code
atcoder

Sample Output 2

No

code is not a prefix of atcoder. Thus, No should be printed.

Sample Input 3

abc
abc

Sample Output 3

Yes

Note that a string is also a prefix of itself.

Sample Input 4

aaaa
aa

Sample Output 4

No

update @ 2024/3/10 11:17:47

}