#include <bits/stdc++.h>
using namespace std;
#define loop(i,n) for (ll i = 0; i < n; i++)
#define ll long long
#define INF 1e9+5
#define MAXN 300007
#define pb push_back
#define mp make_pair
typedef pair<ll,ll> pii;
int main(){
ios::sync_with_stdio(0);
cin.tie(0);
cout.tie(0);
ll t,n;
string s;
cin>>t;
while(t--){
cin>>s;
n=(ll)s.size();
ll i=0,j=n-1,left=0,right=n-1,ans=1;
string mleft, mright;
while(i<j){
mleft=s.substr(left,i-left+1);//de left a i
mright=s.substr(j,right-j+1);//de j a right
if(mleft==mright){
left=i+1; right=j-1;
ans+=2;
}
i++; j--;
}
cout<<ans<<'\n';
}
return 0;
}
# |
결과 |
실행 시간 |
메모리 |
Grader output |
1 |
Incorrect |
1 ms |
384 KB |
Output isn't correct |
2 |
Halted |
0 ms |
0 KB |
- |
# |
결과 |
실행 시간 |
메모리 |
Grader output |
1 |
Incorrect |
1 ms |
384 KB |
Output isn't correct |
2 |
Halted |
0 ms |
0 KB |
- |
# |
결과 |
실행 시간 |
메모리 |
Grader output |
1 |
Incorrect |
1 ms |
384 KB |
Output isn't correct |
2 |
Halted |
0 ms |
0 KB |
- |
# |
결과 |
실행 시간 |
메모리 |
Grader output |
1 |
Incorrect |
1 ms |
384 KB |
Output isn't correct |
2 |
Halted |
0 ms |
0 KB |
- |