Loading...
Loading...
Loading...
Rotating a word moves letters from the front to the back: abcde rotated twice becomes cdeab.
Read two words. Print Yes if the second word is a rotation of the first (any number of steps), otherwise No.
Yes or No.Example
Input
abcde cdeab
Output
Yes
Two steps left.
Try the problem first. Open one hint at a time.
Every rotation of a word appears inside the word written twice in a row.
Also check that both words have the same length, or a short word could match inside a longer one.
Write your Python code, run it on the examples and submit it to hidden tests.
Solve in the editor