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;
#define int long long
#define ff first
#define ss second
#define pb push_back
vector<int>ans;
void fun(){
string s;
cin>>s;
int n=s.size();
string a,b;
int x=-1;
int p=0;
for(int i=0;i<n/2;i++){
a+=s[i];
b=s[n-i-1]+b;
if(a==b){
x=i;
a.clear();
b.clear();
p+=2;
}
//cout<<a<<" "<<b<<endl;
}
if(n%2 or x<n/2-1)p++;
ans.pb(p);
}
signed main(){
int t;
cin>>t;
while(t--)fun();
for(auto a:ans)cout<<a<<endl;
}
# | 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... |