不知道为什么不正确?

Xing126 发表于 28天前 · 关联问题 周期串

不知道是什么原因,怀疑是输入和输出空行没空正确...

N = int(input("\n")) for n in range(N): string = str(input("\n")) k = 1 i = 1 judge = 0 while i < len(string): if string[i:i + k] in string[0:0 + k]: if judge == 0: k = i i -= k elif judge == 1: k = i judge += 1 kj = 1 else: judge = 0 k = 1 kj = 0 i += k if kj == 0: k = len(string) print(k) print()