public class MyClass {
static boolean rotations(String str1, String str2) {
if (str1.length() != str2.length())
return false;
System.out.println(str1 + str1);
return (str1 + str1).indexOf(str2) != -1;
}
public static void main(String args[]) {
String str1 = "abcxd", str2 = "cxdab";
if (rotations(str1, str2))
System.out.println("yes");
else
System.out.printf("no");
}
}
/*
run:
abcxdabcxd
yes
*/