import java.util.*; public class Solution { /** * 旋转字符串 * @param A string字符串 * @param B string字符串 * @return bool布尔型 */ public boolean solve (String A, String B) { // write code here if (A.equals(B)) { return true; } char[] chars = A.toCharArray(); //abcd-bcda-cdab-dabc for (int i = 1; i < chars.length; i++) { String str = A; String tempL = str.substring(0, i); String tempR = str.substring(i, str.length()); String res = tempR + tempL; if (res.equals(B)) { return true; } } return false; } }