Skip to content

Instantly share code, notes, and snippets.

@znxkznxk1030
Last active April 29, 2017 08:59
Show Gist options
  • Save znxkznxk1030/82f3509d1718fcabe8a61db524440827 to your computer and use it in GitHub Desktop.
Save znxkznxk1030/82f3509d1718fcabe8a61db524440827 to your computer and use it in GitHub Desktop.
#410_A.cpp
#include <iostream>
#include <cstdio>
#include <stack>
#include <queue>
#include <algorithm>
#include <cstring>
#include <cmath>
#define MAX(a,b) (a)>(b)?(a):(b)
#define MIN(a,b) (a)>(b)?(b):(a)
#define ll long long int
#define ull unsigned long long int
char s[20];
int l;
bool isPalindrome(int a)
{
if (s[a] == s[l - a - 1] && (a != l - a - 1)) return false;
for (int i = 0; i < l; i++)
{
if (s[i] != s[l - i - 1] && (a != i) && (a != l - i - 1))
{
return false;
}
}
return true;
}
void process() {
for (int i = 0; i < l; i++)
{
if (isPalindrome(i))
{
printf("YES\n");
return;
}
}
printf("NO\n");
return;
}
int main() {
scanf("%s", s);
l = strlen(s);
process();
return 0;
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment