Joos


  • Time Limit : 1 seconds
  • Memory Limit : 256 megabytes

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.

Input🔗

In the first line of the input string ss is given that is actually the string written around the circle. In the second line string pp is given which is Mehrdad's string.

1s,p1 0001 \le |s| , |p| \le 1\ 000

Both strings are made up of lower case English letters.

Output🔗

In the only line of output print "Yes" if Shengdebao can receive the prize and "No" if not.

Examples🔗

Sample input 1🔗

abcab
ababcabab
Plain text

Sample output 1🔗

Yes
Plain text

Explanation: by starting from the 4th character the string pp can be made.

Sample input 2🔗

abcd
bcdabd
Plain text

Sample output 2🔗

No
Plain text
ارسال پاسخ برای این سؤال
در حال حاضر شما دسترسی ندارید.