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;
}
#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;
}

More from author

LEAVE A REPLY

Please enter your comment!
Please enter your name here

Related posts

Advertismentspot_img

Latest posts

We Tested Viral Kitchen Gadgets Here Is What You Must Know

📢 As an Amazon Associate, I earn from qualifying purchases.There comes a point when you realise that tolerating a frustrating situation is costing you...

Supernatural: Wayward Special #1 Preview: Winchesters Split Up

Fans of the long-running television phenomenon Supernatural are in for a fresh dose of nostalgia and hunter drama with the upcoming release of the...

The Real Truth About Viral Kitchen Gadgets Before You Buy

📢 As an Amazon Associate, I earn from qualifying purchases.If you had told me six months ago that a single purchase would change how...

Want to stay up to date with the latest news?

We would love to hear from you! Please fill in your details and we will stay in touch. It's that simple!