Description

Mike has a string s consisting of only lowercase English letters. He wants to change exactly one character from the string so that the resulting one is a palindrome.

A palindrome is a string that reads the same backward as forward, for example strings "z", "aaa", "aba", "abccba" are palindromes, but strings "codeforces", "reality", "ab" are not.

Input

The first and single line contains string s (1 ≤ |s| ≤ 15).

Output

Print "YES" (without quotes) if Mike can change exactly one character so that the resulting string is palindrome or "NO" (without quotes) otherwise.

Examples
input
abccaa
output
YES
input
abbcca
output
NO
input
abcda
output
YES
题意:必须修改一次字符串中的字符,问能不能成为回文串
解法:模拟,注意必须要修改字符
 #include<bits/stdc++.h>
using namespace std;
#define ll long long
const int maxn=;
string s,ss,sss,ssss,s1;
int main()
{
cin>>s;
for(int i=;i<s.size();i++)
{
ss=s;
for(int j=;j<;j++)
{
ss[i]='a'+j;
if(s[i]==ss[i]) continue;
sss=ss;
ssss=ss;
reverse(sss.begin(),sss.end());
if(ssss==sss)
{
cout<<"YES";
return ;
} }
}
cout<<"NO"<<endl;
return ;
}

最新文章

  1. 通过设置CSS属性让DIV水平居中
  2. Python黑帽编程 4.0 网络互连层攻击概述
  3. ENode 2.0 - 第一个真实案例剖析-一个简易论坛(Forum)
  4. ASP文件操作(FSO)详解
  5. PHP程序员的40点陋习,我几乎全部中枪
  6. Write a beautiful button
  7. ACM_基础知识
  8. jQuery Ajax无刷新操作
  9. struts2 表单处理
  10. Android中ListView通过BaseAdapter实现数据的绑定
  11. CentOS7 安装LNMP(Linux+Nginx+MySQL+PHP)
  12. hive函数总结-字符串函数
  13. windows系统npm如何升级自身
  14. C#、VB.NET 使用System.Media.SoundPlayer播放音乐
  15. SpringMVC中采用简洁的配置实现文件上传
  16. int-整数+bool-布尔功能介绍
  17. VS 2008 开发WinCE程序 编译部署速度慢的解决办法
  18. Oarcle 之连接查询
  19. Hibernate入门(四)---------一级缓存
  20. 本博客停止更新改用wordperss

热门文章

  1. iOS xmpp协议实现聊天之openfire的服务端配置(一)
  2. Android Studio 使用正式签名进行调试
  3. spring list map set
  4. URAL 1731. Dill(数学啊 )
  5. Codility经典算法题之九:MissingInteger
  6. input框只允许输入正整数、正数(包含小数)的解决方法 vue.js实现
  7. POJ1077 Eight —— 双向BFS
  8. iOS--控制器加载自定义view的xib
  9. 不用打开Eclipse就可以执行的命令
  10. C. Vanya and Scales