#K65632. Check String Rotation
Check String Rotation
Check String Rotation
Given two strings s1 and s2, determine if s2 is a rotation of s1. A string s2 is considered a rotation of s1 if it can be obtained by moving some prefix of s1 to its end. In mathematical terms, if s1 has length \(n\), then s2 is a rotation of s1 if and only if \(s2 \in s1+s1\) and \(|s1| = |s2|\). For example, if \(s1 = \texttt{waterbottle}\) and \(s2 = \texttt{erbottlewat}\), then s2 is a rotation of s1 because by concatenating s1 with itself and checking for the presence of s2, we find that \(s2 \subset (s1+s1)\).
inputFormat
The input consists of two lines read from standard input. The first line contains the string s1 and the second line contains the string s2.
outputFormat
Output a single line to standard output: True
if s2 is a rotation of s1, or False
otherwise.
waterbottle
erbottlewat
True