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;
typedef long long ll;
#define rep(i, a, b) for(ll i=ll(a); i<ll(b); i++)
#define repn(i, a, b) for(ll i=ll(b)-1; i>=ll(a); i--)
#define be begin()
#define en end()
#define ff first
#define ss second
#define si size()
const ll mod=(1e9)+7;
void solve(){
string s;
cin>>s;
ll n=s.si;
ll l=0, h=n-1;
string s1="", s2="";
ll sum=0;
while(l<h){
s1+=s[l];
s2=s[h]+s2;
if(s1==s2){
sum+=2;
s1="", s2="";
}
l++, h--;
}
if(s1.si>0) sum++;
else if(l==h) sum++;
cout<<sum<<'\n';
}
int main(){
ios_base::sync_with_stdio(0);
cin.tie(0);
ll t=1;
cin>>t;
while(t--){
solve();
}
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... |