Submission #1103884

#TimeUsernameProblemLanguageResultExecution timeMemory
1103884ezzzayPalindromic Partitions (CEOI17_palindromic)C++14
0 / 100
1 ms336 KiB
#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(); int l=0,r=n-1; string a,b; int cnt=0; while(r>l){ a+=s[l]; b=s[r]+b; if(a==b){ a.clear(); b.clear(); cnt+=2; } r--; l++; } if(n%2==0 and s[n/2-1]==s[n/2])cnt--; ans.pb(cnt+1); } signed main(){ int t; cin>>t; while(t--)fun(); for(auto a:ans)cout<<a<<endl; }
#Verdict Execution timeMemoryGrader output
Fetching results...
#Verdict Execution timeMemoryGrader output
Fetching results...
#Verdict Execution timeMemoryGrader output
Fetching results...
#Verdict Execution timeMemoryGrader output
Fetching results...