fork download
  1. def query(s):
  2. k = 2
  3. l = len(s)
  4. s = " " + s
  5.  
  6. for i in range(1, l//2 + 1):
  7. if s[i] != s[l-i+1]:
  8. if not k:
  9. return False
  10. k -= 1
  11. return True
  12.  
  13. def main():
  14. import sys
  15. input = sys.stdin.read
  16. data = input().split()
  17.  
  18. for s in data:
  19. if query(s):
  20. print("YES")
  21. else:
  22. print("NO")
  23.  
  24. if __name__ == "__main__":
  25. main()
  26.  
Success #stdin #stdout 0.02s 7100KB
stdin
Standard input is empty
stdout
Standard output is empty