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 int
#define pb push_back
#define pii pair<int,int>
#define ff first
#define ss second
#define sz size()
const int N = 2e5 + 1;
using namespace std;
bool barla(string st){
string st1 = st;
reverse(st.begin(), st.end());
if(st == st1) return 1;
else return 0;
}
int main(){
ios::sync_with_stdio(false); cin.tie(nullptr);
//freopen("input.in", "r", stdin);
//freopen("output.out", "w", stdout);
ll ans = 0;
string s;
cin >> s;
for(int i = 0; i < (int)s.sz; i++){
string m = "";
for(int j = i; j < (int)s.sz; j++){
m += s[j];
if(barla(m)) ans++;
}
}
cout << ans;
}
# | Verdict | Execution time | Memory | Grader output |
---|
Fetching results... |
# | Verdict | Execution time | Memory | Grader output |
---|
Fetching results... |
# | Verdict | Execution time | Memory | Grader output |
---|
Fetching results... |