import java.util.Scanner;
public class work1068 {
public static void main(String[] args) {
Scanner scanner = new Scanner(System.in);
int n = scanner.nextInt();
System.out.println();
String[] strings = new String[n];
for (int i = 0; i < n; i++) {
strings[i] = scanner.next();
System.out.println();
}
for (int i = 0; i < strings.length; i++) {
int sum = 0;
for (int T= 1; T <=strings[i].length() ; T++) {
if (strings[i].length() %T==0 && method(T,strings[i]) || (i+T) == strings[i].length()){
sum = T;
break;
}
}
if (sum != 0){
System.out.println(sum+"\r\n");
}
}
}
public static boolean method(int T, String s){
char[] chars = s.toCharArray();
for (int i = 0; i +T< chars.length; i++) {
if (chars[i] != chars[i+T]){
return false;
}
}
return true;
}
} 哪里错了啊呜呜
不能 \r\n
吧。印象中 OJ 几乎没有要求输出 \t
的题目。换行就是 \n
。除非题目明确说明,不然一律不使用 \t
作对齐或换行。