def ishui(x):
n= len(x)
for i in range(n//2):
if x[i]!=x[n-1-i]:
return False
return True
def insertS(s):
n=len(s)
if n<=2:
return True
for i in range(n//2):
if s[i]!=s[n-1-i]:
return (ishui(s[:i]+s[i+1:]) or ishui(s[:n-1-i]+s[n-i:]))
return True
try:
while True:
s=raw_input().strip()
if not s:
break
if insertS(s):
print("YES")
else:
print("NO")
except IOError as e:
print ('errno:', e.errno)
print(e)
题目:http://www.nowcoder.com/questionTerminal/655a43d702cd466093022383c24a38bf
本地通过,在线总是提示: 请检查是否存在数组越界非法访问等情况