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
Hint 1Approach
Hint 2Approach
Hint 3Pseudocode
Hint 4Full solution