#include <bits/stdc++.h>
using namespace std;
int main() {
int t;
cin >> t;
while ( t-- ) {
string s;
cin >> s;
int l = 0, r = s.size() - 1, cuv = 0;
while ( l <= r ) {
string a = "", b = "";
int i = 1;
while ( i <= (r - l + 1) / 2 ) {
a += s[l + i - 1];
b += s[r - i + 1];
reverse( b.begin(), b.end());
if ( a == b )
break;
reverse( b.begin(), b.end());
i++;
}
if ( i <= (r - l + 1) / 2 ) {
l += i;
r -= i;
cuv += 2;
} else {
cuv++;
break;
}
}
cout << cuv << "\n";
}
return 0;
}
# |
Verdict |
Execution time |
Memory |
Grader output |
1 |
Correct |
0 ms |
348 KB |
Output is correct |
2 |
Correct |
0 ms |
348 KB |
Output is correct |
3 |
Correct |
0 ms |
348 KB |
Output is correct |
4 |
Correct |
0 ms |
348 KB |
Output is correct |
5 |
Correct |
0 ms |
344 KB |
Output is correct |
# |
Verdict |
Execution time |
Memory |
Grader output |
1 |
Correct |
0 ms |
348 KB |
Output is correct |
2 |
Correct |
0 ms |
348 KB |
Output is correct |
3 |
Correct |
0 ms |
348 KB |
Output is correct |
4 |
Correct |
0 ms |
348 KB |
Output is correct |
5 |
Correct |
0 ms |
344 KB |
Output is correct |
6 |
Correct |
1 ms |
344 KB |
Output is correct |
7 |
Correct |
0 ms |
348 KB |
Output is correct |
8 |
Correct |
0 ms |
348 KB |
Output is correct |
9 |
Correct |
0 ms |
344 KB |
Output is correct |
# |
Verdict |
Execution time |
Memory |
Grader output |
1 |
Correct |
0 ms |
348 KB |
Output is correct |
2 |
Correct |
0 ms |
348 KB |
Output is correct |
3 |
Correct |
0 ms |
348 KB |
Output is correct |
4 |
Correct |
0 ms |
348 KB |
Output is correct |
5 |
Correct |
0 ms |
344 KB |
Output is correct |
6 |
Correct |
1 ms |
344 KB |
Output is correct |
7 |
Correct |
0 ms |
348 KB |
Output is correct |
8 |
Correct |
0 ms |
348 KB |
Output is correct |
9 |
Correct |
0 ms |
344 KB |
Output is correct |
10 |
Correct |
53 ms |
448 KB |
Output is correct |
11 |
Correct |
51 ms |
348 KB |
Output is correct |
12 |
Correct |
5 ms |
348 KB |
Output is correct |
13 |
Correct |
2 ms |
344 KB |
Output is correct |
# |
Verdict |
Execution time |
Memory |
Grader output |
1 |
Correct |
0 ms |
348 KB |
Output is correct |
2 |
Correct |
0 ms |
348 KB |
Output is correct |
3 |
Correct |
0 ms |
348 KB |
Output is correct |
4 |
Correct |
0 ms |
348 KB |
Output is correct |
5 |
Correct |
0 ms |
344 KB |
Output is correct |
6 |
Correct |
1 ms |
344 KB |
Output is correct |
7 |
Correct |
0 ms |
348 KB |
Output is correct |
8 |
Correct |
0 ms |
348 KB |
Output is correct |
9 |
Correct |
0 ms |
344 KB |
Output is correct |
10 |
Correct |
53 ms |
448 KB |
Output is correct |
11 |
Correct |
51 ms |
348 KB |
Output is correct |
12 |
Correct |
5 ms |
348 KB |
Output is correct |
13 |
Correct |
2 ms |
344 KB |
Output is correct |
14 |
Execution timed out |
10021 ms |
6336 KB |
Time limit exceeded |
15 |
Halted |
0 ms |
0 KB |
- |