Submission #447363

#TimeUsernameProblemLanguageResultExecution timeMemory
447363fuad27Palindromic Partitions (CEOI17_palindromic)C++14
60 / 100
10076 ms3868 KiB
#include<bits/stdc++.h> using namespace std; #define int long long int32_t main () { int t; cin >> t; while(t--) { string s; cin >> s; int ans = 0, n = s.length(); string l = "", r = ""; for(int i = 0;i<n/2;i++) { l += s[i]; r = s[n-i-1] + r; if(l == r){ l = ""; r = ""; ans+=2; } } if(l.size() > 0 or n%2 == 1)ans++; cout<<ans<<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...