#include <bits/stdc++.h>
using namespace std;
int main()
{
string s, ss;
int cnt = 0;
cout << "Input string: ";
cin >> s;
ss = s;
reverse(ss.begin(), ss.end());
for (int i = 0; i < s.size(); i++) {
if (ss[i] == s[i]) cnt++;
}
cout << "Answer: " << cnt << '\n';
return 0;
}
Comments
Leave a comment