This submission is migrated from previous version of oj.uz, which used different machine for grading. This submission may have different result if resubmitted.
/*
* Author: fuad720
* Time: 2023-05-31 21:05
*/
// =========== Template ========== //
#ifndef LOCAL
#pragma GCC optimize("O3,unroll-loops")
#pragma GCC target("avx2,bmi,bmi2,lzcnt,popcnt")
#include <bits/stdc++.h>
#include <ext/pb_ds/assoc_container.hpp>
#include <ext/pb_ds/tree_policy.hpp>
#else
#include "/home/fuad/cp/all.h"
#endif
#include<ext/rope>
using namespace std;
using namespace __gnu_cxx;
using namespace __gnu_pbds;
template <typename T>
using oset =
tree<T, null_type, less<T>, rb_tree_tag, tree_order_statistics_node_update>;
template <typename T>
using omset =
tree<T, null_type, less_equal<T>, rb_tree_tag, tree_order_statistics_node_update>;
using ll = long long;
using ull = unsigned long long;
using ld=long double;
using lll = __int128_t;
using ulll = __uint128_t;
#define FOR(i,a,b) for(int i=int(a);i<int(b);i++)
#define rep(i,b) FOR(i,0,b)
#define FORN(i,a,b) for(int i=int(b)-1;i>=a;i--)
#define per(i,b) FORN(i,0,b)
#define mkp make_pair
#define pb push_back
#define ep emplace_back
#define ins insert
#define ff first
#define ss second
#define bg begin()
#define ed end()
#define sz(x) (int)x.size()
#define all(x) (x).bg,(x).ed
#define FIO ios_base::sync_with_stdio(0);\
cin.tie(0);
template<class t> using vc=vector<t>;;
template<class t> using vvc=vc<vc<t>>;
template<class F, class S> using pr=pair<F,S>;
using pii=pair<int,int>;
using pll=pair<ll,ll>;
using vi= vc<int>;
using vll= vc<ll>;
#define mset multiset
#define umap unordered_map
#define pqueue priority_queue
int nxt() {
int x;
cin >> x;
return x;
}
ll nxtll() {
ll x;
cin >> x;
return x;
}
#ifdef LOCAL
#include "/home/fuad/cp/dbg.h"
#else
#define dbg(x...)
#endif
const ll INFL=(ll)1e18;
const int INF=(ll)2e9;
mt19937 rng(chrono::steady_clock::now().time_since_epoch().count());
mt19937_64 rngll(chrono::steady_clock::now().time_since_epoch().count());
// =========== Solution ========== //
void solve() {
string s;
cin >> s;
int ans = 0, n = s.length();
crope l = "", r = "";
for(int i = 0;i<n/2;i++) {
l += s[i];
r = crope(s[n-i-1]) + r;
if(l == r){
l = "";
r = "";
ans+=2;
}
}
if(l.size() > 0 or n%2 == 1)ans++;
cout<<ans<<'\n';
}
signed main () {
FIO;
int t=1;
cin >> t;
while(t--)
solve();
}
# | 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... |