81. Is It a Rotation?
Challenge1000 ms256 MBSolved by 0%
Read two lines and print Yes if the second is a rotation of the first, or
No otherwise.
A rotation moves some characters from the front to the back without changing their order.
erbottlewat is a rotation of waterbottle.
Two identical strings count as rotations of each other.
Constraints - Each line has between 1 and 100000 characters. - Printable ASCII only.
Input
Two lines, each containing one string.
Output
Print exactly one word: Yes or No.
Inputwaterbottle
erbottlewat
OutputYes
Noteis the worked example from the statement
Inputhello
world
OutputNo
Noteis not a rotation
Hints
Four rungs, in order. The last two open once you have submitted an attempt. A wrong one counts.
Hint 1Where to start
Hint 2The approachOpen hint 1 first. This one carries on from it.
Hint 3PseudocodeOpen hint 2 first. This one carries on from it.
Hint 4Full solutionOpen hint 3 first. This one carries on from it.