#abc360b. B - Vertical Reading
B - Vertical Reading
Score : points
问题陈述
给定两个由小写英文字母组成的字符串 和 。
确定是否存在一对整数 和 ,使得 并且满足以下条件。这里, 表示字符串 的长度。注意 必须 小于 。
- 如果从字符串 的开头每 个字符分割一次,那么长度至少为 的子串的第 个字符按顺序连接起来等于 。
以上为大语言模型 kimi 翻译,仅供参考。
Problem Statement
You are given two strings and consisting of lowercase English letters.
Determine if there exists a pair of integers and such that and the following condition is satisfied. Here, denotes the length of the string . Note that must be less than .
- If is split at every characters from the beginning, the concatenation of the -th characters of the substrings of length at least in order equals .
Constraints
- and are strings consisting of lowercase English letters.
Input
The input is given from Standard Input in the following format:
Output
Print Yes
if there exists a pair of integers and such that and the condition is satisfied, and No
otherwise.
Sample Input 1
atcoder toe
Sample Output 1
Yes
If 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 is toe
, which equals . Thus, print Yes
.
Sample Input 2
beginner r
Sample Output 2
No
is not allowed, and no pair of integers satisfies the condition. Thus, print No
.
Sample Input 3
verticalreading agh
Sample Output 3
No