102791: [AtCoder]ABC279 B - LOOKUP

Memory Limit:256 MB Time Limit:2 S
Judge Style:Text Compare Creator:
Submit:17 Solved:0

Description

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$.

Input

题意翻译

【题面翻译】 给定两个字符串 $s$ 与 $t$,求 $t$ 是不是 $s$ 的子串。 translated by @[liangbowen](https://www.luogu.com.cn/user/367488)。

Output

得分:200分

问题描述

给定由小写英文字母组成的字符串$S$和$T$。判断$T$是否为$S$的(连续)子串。

如果$Y$可以通过对$X$进行以下操作零次或多次得到,则称$Y$为$X$的(连续)子串。

  • 执行以下操作之一。
    • 删除$X$的第一个字符。
    • 删除$X$的最后一个字符。

例如,tagvoltage的(连续)子串,而ace不是atcoder的(连续)子串。

约束

  • $S$和$T$由小写英文字母组成。
  • $1 \le |S|,|T| \le 100$($|X|$表示字符串$X$的长度)。

输入

输入从标准输入按以下格式给出:

$S$
$T$

输出

如果$T$是$S$的(连续)子串,打印Yes;否则,打印No


样例输入1

voltage
tag

样例输出1

Yes

tagvoltage的(连续)子串。


样例输入2

atcoder
ace

样例输出2

No

ace不是atcoder的(连续)子串。


样例输入3

gorilla
gorillagorillagorilla

样例输出3

No

样例输入4

toyotasystems
toyotasystems

样例输出4

Yes

可能有$S=T$。

加入题单

算法标签: