This submission is migrated from previous version of oj.uz, which used different machine for grading. This submission may have different result if resubmitted.
#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 |
---|
Fetching results... |
# | Verdict | Execution time | Memory | Grader output |
---|
Fetching results... |
# | Verdict | Execution time | Memory | Grader output |
---|
Fetching results... |
# | Verdict | Execution time | Memory | Grader output |
---|
Fetching results... |