#include "bits/stdc++.h"
using namespace std;
void solve(){
string s;
cin >> s;
int n = s.size();
int l = 0,r = n - 1;
int count = 0;
while(l < r){
string pref = "",suff = "";
pref += s[l];
suff += s[r];
l++;
r--;
while(l < r && pref != suff){
pref += s[l];
l++;
suff = s[r] + suff;
r--;
}
if(pref == suff){
count += 2;
}
}
cout << count + 1 << "\n";
}
//(h[i] - h[j]) * (h[i] - h[j]) + pref[i] - pref[j + 1]
signed main(){
ios_base::sync_with_stdio(0);
cin.tie(0),cout.tie(0);
int t = 1;
cin >> t;
while(t--){
solve();
}
}
# |
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 |
- |