- محدودیت زمان: ۱ ثانیه
- محدودیت حافظه: ۲۵۶ مگابایت
Shengdebao had grown tired of the everyday life he had, so he decided to write down a set of letters around a circle. Mehrdad also had a string made up of lower case English letters. Shengdebao then decided to start from one letter on that circle and go around it in clockwise direction.
If at any point of time the string that Shengdebao makes by turning around the circle becomes equal to the one Mehrdad has, Mehrdad is obligated to give Shengdebao a prize! (or "Shirini" as they call it!)
Shengdebao wants to know whether he can or cannot receive a prize, and for that reason he has asked you to help him solve this problem.
ورودی
In the first line of the input string $s$ is given that is actually the string written around the circle. In the second line string $p$ is given which is Mehrdad's string.
$$1 \le |s| , |p| \le 1\ 000$$
Both strings are made up of lower case English letters.
خروجی
In the only line of output print "Yes" if Shengdebao can receive the prize and "No" if not.
مثال
ورودی نمونه ۱
abcab
ababcabab
خروجی نمونه ۱
Yes
Explanation: by starting from the 4th character the string $p$ can be made.
ورودی نمونه ۲
abcd
bcdabd
خروجی نمونه ۲
No
ارسال پاسخ برای این سؤال