#K54027. Cyclic Rotation Checker
Cyclic Rotation Checker
Cyclic Rotation Checker
Given two strings s1 and s2, determine if s2 is a cyclic rotation of s1. A string s2 is considered a cyclic rotation of s1 if it can be obtained by taking a prefix of s1 and appending it to the end of the remaining string. Formally, if s1 can be split into two parts, a and b, such that:
then s2 must be:
If the lengths of s1 and s2 differ, i.e., $$|s1| \neq |s2|$$, then s2 cannot be a cyclic rotation of s1.
inputFormat
The input consists of two lines: the first line contains the string s1 and the second line contains the string s2.
outputFormat
Output a single line: "YES" if s2 is a cyclic rotation of s1, otherwise "NO".## sample
abcde
cdeab
YES