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 <iostream>
#include <string>
using namespace std;
int main(){
int t;
cin >> t;
for (int ij = 0; ij < t; ij++){
string s;
cin >> s;
int sol = 1;
int n = s.size();
int d = 1, o = 0;
for (int i = 0; i < n/2; i++){
int boo = 1;
for (int j = 0; j < d; j++){
if (s[o+j] != s[n-o-d+j]){
boo = 0;
break;
}
}
if (boo){
o += d;
d = 0;
sol+= 2;
}
d++;
}
if (n%2 == 0 && d == 1)sol--;
cout << sol << "\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... |