10896: ABC360 - B - Vertical Reading
Description
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$.
Input
```
$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.
Constraints
- $1 \leq |T|$ $ \leq $ $|S| \leq 100$
Sample 1 Input
atcoder toe
Sample 1 Output
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 2 Input
beginner r
Sample 2 Output
No
$w=|S|$ is not allowed, and no pair of integers $1 \leq c \leq w < |S|$ satisfies the condition. Thus, print No
.
Sample 3 Input
verticalreading agh
Sample 3 Output
No