#include<iostream> #include<string> usingnamespace std; intissame(string &s, int a, int b)//比较是否相同的函数 { for (int i = a; i < b; i += a) { if (s.substr(0, a) != s.substr(i, a)) return0; } return1; } intmain() { //freopen("data.in", "r", stdin); //freopen("data.out", "w", stdout); int t = 0; cin >> t; while (t--) { string a; cin >> a; int n = a.size(); int i = 1,k=0; for (i; i <= n; ++i) { if (n%i == 0) { if (issame(a, i, n)) //如果相同就使用当前的i { k = i; break; } } } if (t == 0) cout << k << endl; //输出ik,要注意题目要求的输出格式问题 else cout << k << endl << endl; }