This submission is migrated from previous version of oj.uz, which used different machine for grading. This submission may have different result if resubmitted.
#include<bits/stdc++.h>
#define ll long long
#define vi vector<ll>
#define vvi vector<vi>
#define pp pair<ll, ll>
#define inf 1000000000000000
using namespace std;
string s;
bool test(string x, int i, int j){ // all in
bool is = true;
for(int k = i; k <= j; k++){
if(x[k - i] != s[k]){
is = false;
}
}
return is;
}
int main(){
int t;
cin >> t;
while(t--){
cin >> s;
int n = s.size();
int ans = 0;
int mid = n/2;
string akt = "";
for(int i = 0; i < mid; i++){
akt += s[i];
if(test(akt, n - 1 - i, n - 1 - (i - akt.size() + 1))){
ans += 2;
akt = "";
}
}
if(n %2 == 1) akt += "a";
if(akt != ""){
ans++;
}
cout << ans << endl;
}
}
# | 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... |