#pragma GCC optimize("O3")
#include <iostream>
using namespace std;
int n;
string s;
bool check_equal(int a, int b, int l) {
for (int i = 0; i < l; i++) {
if (s[a + i] != s[b + i]) {
return false;
}
}
return true;
}
int main() {
ios_base::sync_with_stdio(false);
cin.tie(NULL);
int T;
cin >> T;
while(T--) {
cin >> s;
n = s.size();
int res = 0;
int l = 0, r = n - 1;
while(l < r) {
int len = 1;
while (l + len <= r && !check_equal(l, r - len + 1, len)) {
len++;
}
res += 2;
l += len;
r -= len;
}
if (l == r) {
res++;
} else if (l > r) {
res--;
}
cout << res << "\n";
}
return 0;
}
# |
Verdict |
Execution time |
Memory |
Grader output |
1 |
Incorrect |
1 ms |
348 KB |
Output isn't correct |
2 |
Halted |
0 ms |
0 KB |
- |
# |
Verdict |
Execution time |
Memory |
Grader output |
1 |
Incorrect |
1 ms |
348 KB |
Output isn't correct |
2 |
Halted |
0 ms |
0 KB |
- |
# |
Verdict |
Execution time |
Memory |
Grader output |
1 |
Incorrect |
1 ms |
348 KB |
Output isn't correct |
2 |
Halted |
0 ms |
0 KB |
- |
# |
Verdict |
Execution time |
Memory |
Grader output |
1 |
Incorrect |
1 ms |
348 KB |
Output isn't correct |
2 |
Halted |
0 ms |
0 KB |
- |