#include <bits/stdc++.h>
using namespace std;
int32_t main(){
ios_base::sync_with_stdio(false);
cin.tie(0);
int q;
cin >> q;
while(q--){
string s;
cin >> s;
int ans = 0;
int i=0, j=(int)s.size()-1;
string L, R;
L = R = "";
for(;i<j;i++,j--){
L += s[i];
R = s[j] + R;
if(L == R){
ans += 2;
L = R = "";
}
}
if(i <= j || L.size()) ans++;
cout << ans << '\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... |