

Time Limit: 2 sec / Memory Limit: 1024 MB
配点 : 200 点
問題文
英小文字のみからなる 2 つの文字列 S, T が与えられます。 S が T の接頭辞かどうかを判定してください。
接頭辞とは
長さ N の文字列 T_1T_2\ldots T_N の接頭辞とは、 0 \leq i \leq N を満たすある整数 i によって、T の先頭 i 文字目までの文字列 T_1T_2\ldots T_i として表される文字列です。例えば、T = abc のとき、T の接頭辞は、空文字列、a 、ab 、abc の 4 つです。制約
- S と T はそれぞれ英小文字のみからなる長さが 1 以上 100 以下の文字列
入力
入力は以下の形式で標準入力から与えられる。
S T
出力
S が T の接頭辞である場合は Yes
を、そうでない場合は No
を出力せよ。
ジャッジは英小文字と英大文字を厳密に区別することに注意せよ。
入力例 1
atco atcoder
出力例 1
Yes
atco
は atcoder
の接頭辞です。よって、Yes
を出力します。
入力例 2
code atcoder
出力例 2
No
code
は atcoder
の接頭辞ではありません。よって、No
を出力します。
入力例 3
abc abc
出力例 3
Yes
文字列全体もその文字列の接頭辞であることに注意してください。
入力例 4
aaaa aa
出力例 4
No
Score : 200 points
Problem Statement
You are given two strings S and T consisting of lowercase English letters. Determine if S is a prefix of T.
What is a prefix?
A prefix of a string T_1T_2\ldots T_N of length N is a string expressed as the first i characters of T, T_1T_2\ldots T_i, where i is an integer such that 0 \leq i \leq N. For example, when T = abc, there are four prefixes of T: an empty string, a, ab, and abc.Constraints
- S and T are strings of lengths between 1 and 100 (inclusive) consisting of lowercase English letters.
Input
Input is given from Standard Input in the following format:
S T
Output
Print Yes
if S is a prefix of T; 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