#include<iostream>
using namespace std;
#define int long long
#pragma GCC optimize("Ofast")
#pragma GCC target("avx,avx2,fma")
int32_t main () {
ios_base::sync_with_stdio(0);
cin.tie(0);
cout.tie(0);
int t;
cin >> t;
while(t--) {
string s;
cin >> s;
int ans = 0, n = s.length();
long long l = 0, r = 0;
for(int i = 0;i<n/2;i++) {
l += s[i];
r = s[n-i-1] + r;
if(l == r){
l = 0;
r = 0;
ans+=2;
}
}
if(l > 0 or n%2 == 1)ans++;
cout<<ans<<'\n';
}
}
# |
Verdict |
Execution time |
Memory |
Grader output |
1 |
Incorrect |
0 ms |
204 KB |
Output isn't correct |
2 |
Halted |
0 ms |
0 KB |
- |
# |
Verdict |
Execution time |
Memory |
Grader output |
1 |
Incorrect |
0 ms |
204 KB |
Output isn't correct |
2 |
Halted |
0 ms |
0 KB |
- |
# |
Verdict |
Execution time |
Memory |
Grader output |
1 |
Incorrect |
0 ms |
204 KB |
Output isn't correct |
2 |
Halted |
0 ms |
0 KB |
- |
# |
Verdict |
Execution time |
Memory |
Grader output |
1 |
Incorrect |
0 ms |
204 KB |
Output isn't correct |
2 |
Halted |
0 ms |
0 KB |
- |