/
Time Limit: 2 sec / Memory Limit: 1024 MiB
配点 : 200 点
問題文
英小文字からなる文字列 S,T が与えられるので、 T が S の(連続する)部分文字列かどうか判定してください。
なお、文字列 X に以下の操作を 0 回以上施して文字列 Y が得られる時、またその時に限り Y は X の(連続する)部分文字列であると言います。
- 以下の 2 つの操作から 1 つを選択して、その操作を行う。
- X の先頭の 1 文字を削除する。
- X の末尾の 1 文字を削除する。
例えば tag は voltage の(連続する)部分文字列ですが、 ace は atcoder の(連続する)部分文字列ではありません。
制約
- S,T は英小文字からなる
- 1 \le |S|,|T| \le 100 ( |X| は文字列 X の長さ )
入力
入力は以下の形式で標準入力から与えられる。
S T
出力
T が S の(連続する)部分文字列なら Yes 、そうでないなら No と出力せよ。
入力例 1
voltage tag
出力例 1
Yes
tag は voltage の(連続する)部分文字列です。
入力例 2
atcoder ace
出力例 2
No
ace は atcoder の(連続する)部分文字列ではありません。
入力例 3
gorilla gorillagorillagorilla
出力例 3
No
入力例 4
toyotasystems toyotasystems
出力例 4
Yes
S=T である場合もあります。
Score : 200 points
Problem Statement
You are given strings S and T consisting of lowercase English letters. Determine whether T is a (contiguous) substring of S.
A string Y is said to be a (contiguous) substring of X if and only if Y can be obtained by performing the operation below on X zero or more times.
- Do one of the following.
- Delete the first character in X.
- Delete the last character in X.
For instance, tag is a (contiguous) substring of voltage, while ace is not a (contiguous) substring of atcoder.
Constraints
- S and T consist of lowercase English letters.
- 1 \le |S|,|T| \le 100 (|X| denotes the length of a string X.)
Input
The input is given from Standard Input in the following format:
S T
Output
If T is a (contiguous) substring of S, print Yes; otherwise, print No.
Sample Input 1
voltage tag
Sample Output 1
Yes
tag is a (contiguous) substring of voltage.
Sample Input 2
atcoder ace
Sample Output 2
No
ace is not a (contiguous) substring of atcoder.
Sample Input 3
gorilla gorillagorillagorilla
Sample Output 3
No
Sample Input 4
toyotasystems toyotasystems
Sample Output 4
Yes
It is possible that S=T.