https://i1.wp.com/eblogarithm.com/wp-content/uploads/2017/07/Codeforces-Round-410-Div-2-problem-A-Mike-and-palindrome-Solution-In-CC1.png?fit=640%2C360

Codeforces Round #410 (Div. 2), problem: (A) Mike and palindrome Solution In C/C++

#include<iostream>
using namespace std;
main()
{
	string s;cin>>s;
	int n=s.size(),cnt=0;
	for(int i=0;i<n/2;i++)
	{
		if(s[i]!=s[n-i-1])cnt++;
	}
	cout<<(cnt==1||cnt==0&&n%2==1?"YES":"NO")<<endl;
}
(Visited 70 times, 1 visits today)



There are no comments

Add yours

Leave a Reply

%d bloggers like this: