#abc360b. B - Vertical Reading

B - Vertical Reading

Score : 200200 points

问题陈述

给定两个由小写英文字母组成的字符串 SSTT

确定是否存在一对整数 ccww,使得 1cw<S1 \leq c \leq w < |S| 并且满足以下条件。这里,S|S| 表示字符串 SS 的长度。注意 ww 必须 小于 S|S|

  • 如果从字符串 SS 的开头每 ww 个字符分割一次,那么长度至少为 cc 的子串的第 cc 个字符按顺序连接起来等于 TT

以上为大语言模型 kimi 翻译,仅供参考。

Problem Statement

You are given two strings SS and TT consisting of lowercase English letters.

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

  • If SS is split at every ww characters from the beginning, the concatenation of the cc-th characters of the substrings of length at least cc in order equals TT.

Constraints

  • SS and TT are strings consisting of lowercase English letters.
  • 1T1 \leq |T| \leq S100|S| \leq 100

Input

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

SS TT

Output

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

Sample Input 1

atcoder toe

Sample Output 1

Yes

If SS 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 22 is toe, which equals TT. Thus, print Yes.

Sample Input 2

beginner r

Sample Output 2

No

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

Sample Input 3

verticalreading agh

Sample Output 3

No