AtCoder Beginner Contest 103
B
String Rotation
AtCoder
⌀ 110
原题
← AC →
翻译中…

Problem Statement

翻译中…

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

翻译中…

Determine if $S$ equals $T$ after rotation.

翻译中…

That is, determine if $S$ equals $T$ after the following operation is performed some number of times:

翻译中…

Operation: Let $S = S_1 S_2 ... S_{|S|}$. Change $S$ to $S_{|S|} S_1 S_2 ... S_{|S|-1}$.

翻译中…

Here, $|X|$ denotes the length of the string $X$.

翻译中…

Constraints

翻译中…
  • $2 \leq |S| \leq 100$
  • $|S| = |T|$
  • $S$ and $T$ consist of lowercase English letters.
翻译中…

Input

翻译中…

Input is given from Standard Input in the following format:

翻译中…

S
T

翻译中…

Output

翻译中…

If $S$ equals $T$ after rotation, print Yes; if it does not, print No.

翻译中…

样例

Input #1
kyoto
tokyo
Output #1
Yes
- In the first operation, `kyoto` becomes `okyot`. - In the second operation, `okyot` becomes `tokyo`.
Input #2
abc
arc
Output #2
No
`abc` does not equal `arc` after any number of operations.
Input #3
aaaaaaaaaaaaaaab
aaaaaaaaaaaaaaab
Output #3
Yes
题目信息
题号
abc103_b
时间限制
2 s
内存限制
1024 MB

题面与样例版权归 AtCoder 及出题人所有;中文翻译由 AI 生成(CI 管线),如有出入请以原文为准。