#abc279b. B - LOOKUP
B - LOOKUP
Score : points
问题描述
给定由小写英文字母组成的字符串 和 。判断 是否为 的(连续)子串。
若一个字符串 可以通过以下操作对 零次或多次执行后得到,则称 是 的(连续)子串。
- 执行以下任一操作:
- 删除 中的第一个字符。
- 删除 中的最后一个字符。
例如,tag
是 voltage
的(连续)子串,而 ace
不是 atcoder
的(连续)子串。
以上为通义千问 qwen-max 翻译,仅供参考。
Problem Statement
You are given strings and consisting of lowercase English letters. Determine whether is a (contiguous) substring of .
A string is said to be a (contiguous) substring of if and only if can be obtained by performing the operation below on zero or more times.
- Do one of the following.
- Delete the first character in .
- Delete the last character in .
For instance, tag
is a (contiguous) substring of voltage
, while ace
is not a (contiguous) substring of atcoder
.
Constraints
- and consist of lowercase English letters.
- ( denotes the length of a string .)
Input
The input is given from Standard Input in the following format:
Output
If is a (contiguous) substring of , 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 .
update @ 2024/3/10 11:44:01