D. Vertical Reading

    传统题 1000ms 256MiB

Vertical Reading

该比赛已结束,您无法在比赛模式下递交该题目。您可以点击“在题库中打开”以普通模式查看和递交本题。

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 \le c \le 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.
  • 1TS1001 \le |T| \le |S| \le 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 cc and ww such that 1cw<S1 \le c \le w < |S| and the condition is satisfied, and No otherwise.

Sample

atcoder toe
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.

beginner r
No

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

verticalreading agh
No

Programming exercise on 11 August

未参加
状态
已结束
规则
IOI
题目
4
开始于
2024-8-11 16:30
结束于
2024-8-11 17:30
持续时间
1 小时
主持人
参赛人数
2