/**
* Check if Given strings are roated form of each other
* @author PRATEEK
*/
class RotatedStrings {
public static void main
(String[] args
) { System.
out.
println(isRotated
("coding",
"dingco")); }
/**
* @return: true if strings are rotated form of each other
*/
return s1.length()==s2.length() && (s1+s1).indexOf(s2)!=-1 ;
}
}
LyoqCiAqIENoZWNrIGlmIEdpdmVuIHN0cmluZ3MgYXJlIHJvYXRlZCBmb3JtIG9mIGVhY2ggb3RoZXIKICogQGF1dGhvciBQUkFURUVLCiAqLwogY2xhc3MgUm90YXRlZFN0cmluZ3MgewoKCXB1YmxpYyBzdGF0aWMgdm9pZCBtYWluKFN0cmluZ1tdIGFyZ3MpIHsKCQlTeXN0ZW0ub3V0LnByaW50bG4oaXNSb3RhdGVkKCJjb2RpbmciLCJkaW5nY28iKSk7Cgl9CgkKCS8qKgoJICogQHJldHVybjogdHJ1ZSBpZiBzdHJpbmdzIGFyZSByb3RhdGVkIGZvcm0gb2YgZWFjaCBvdGhlcgoJICovCglwdWJsaWMgc3RhdGljIGJvb2xlYW4gaXNSb3RhdGVkKFN0cmluZyBzMSxTdHJpbmcgczIpewoJCXJldHVybiBzMS5sZW5ndGgoKT09czIubGVuZ3RoKCkgJiYgKHMxK3MxKS5pbmRleE9mKHMyKSE9LTEgOwoJfQp9Cg==