103601: [Atcoder]ABC360 B - Vertical Reading

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

Description

Score : $200$ points

Problem Statement

You are given two strings $S$ and $T$ consisting of lowercase English letters.

Determine if there exists a pair of integers $c$ and $w$ such that $1 \leq c \leq w < |S|$ and the following condition is satisfied. Here, $|S|$ denotes the length of the string $S$. Note that $w$ must be less than $|S|$.

  • If $S$ is split at every $w$ characters from the beginning, the concatenation of the $c$-th characters of the substrings of length at least $c$ in order equals $T$.

Constraints

  • $S$ and $T$ are strings consisting of lowercase English letters.
  • $1 \leq |T| < |S| \leq 100$

Input

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

$S$ $T$

Output

Print Yes if there exists a pair of integers $c$ and $w$ such that $1 \leq c \leq w < |S|$ and the condition is satisfied, and No otherwise.


Sample Input 1

atcoder toe

Sample Output 1

Yes

If $S$ is split at every two characters, it looks like this:

at
co
de
r

Then, the concatenation of the 2nd characters of the substrings of length at least $2$ is toe, which equals $T$. Thus, print Yes.


Sample Input 2

beginner r

Sample Output 2

No

$w=|S|$ is not allowed, and no pair of integers $1 \leq c \leq w < |S|$ satisfies the condition. Thus, print No.


Sample Input 3

verticalreading agh

Sample Output 3

No

Output

得分:200分

问题陈述

给定由小写英文字母组成的两个字符串S和T。

判断是否存在一对整数c和w,使得1≤c≤w<|S|,并且满足以下条件。这里,|S|表示字符串S的长度。注意,w必须小于|S|。

  • 如果S从开头每w个字符分割一次,那么按顺序连接长度至少为c的子字符串的第c个字符等于T。

约束条件

  • S和T是由小写英文字母组成的字符串。
  • 1≤|T|<|S|≤100

输入

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

S T

输出

如果存在一对整数c和w,使得1≤c≤w<|S|且满足条件,则打印Yes,否则打印No


示例输入1

atcoder toe

示例输出1

Yes

如果S每两个字符分割一次,看起来像这样:

at
co
de
r

那么,长度至少为2的子字符串的第2个字符的连接是toe,等于T。因此,打印Yes


示例输入2

beginner r

示例输出2

No

w=|S|是不允许的,并且没有一对整数1≤c≤w<|S|满足条件。因此,打印No


示例输入3

verticalreading agh

示例输出3

No

加入题单

算法标签: