#abc279b. B - LOOKUP

B - LOOKUP

Score : 200200 points

问题描述

给定由小写英文字母组成的字符串 SSTT。判断 TT 是否为 SS 的(连续)子串。

若一个字符串 YY 可以通过以下操作对 XX 零次或多次执行后得到,则称 YYXX 的(连续)子串。

  • 执行以下任一操作:
    • 删除 XX 中的第一个字符。
    • 删除 XX 中的最后一个字符。

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

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

Problem Statement

You are given strings SS and TT consisting of lowercase English letters. Determine whether TT is a (contiguous) substring of SS.

A string YY is said to be a (contiguous) substring of XX if and only if YY can be obtained by performing the operation below on XX zero or more times.

  • Do one of the following.
    • Delete the first character in XX.
    • Delete the last character in XX.

For instance, tag is a (contiguous) substring of voltage, while ace is not a (contiguous) substring of atcoder.

Constraints

  • SS and TT consist of lowercase English letters.
  • 1S,T1001 \le |S|,|T| \le 100 (X|X| denotes the length of a string XX.)

Input

The input is given from Standard Input in the following format:

SS

TT

Output

If TT is a (contiguous) substring of SS, 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=TS=T.

update @ 2024/3/10 11:44:01