#C14102. String Rotation Checker

    ID: 43715 Type: Default 1000ms 256MiB

String Rotation Checker

String Rotation Checker

Given two strings, str1 and str2, determine if str2 is a rotation of str1. A string str2 is a rotation of str1 if there exists an integer ( k ) ((0 \leq k < n), where ( n ) is the length of str1) such that str1 can be split into two parts ( x ) and ( y ) with str1 = (xy) and str2 = (yx).

For example, if str1 = "waterbottle" and str2 = "erbottlewat", then str2 is a rotation of str1 because it can be obtained by splitting "waterbottle" into "water" and "bottle", and then rearranging them as "bottlewater" (which contains the given str2 as a rotation). Use minimal extra space for your solution.

inputFormat

The input consists of two lines read from standard input. The first line contains the string str1 and the second line contains the string str2.

outputFormat

Output a single line to standard output: either "True" if str2 is a rotation of str1, or "False" otherwise.## sample

waterbottle
erbottlewat
True