Given a string s. Can you make it a palindrome by deleting exactly one character? Note that size of the string after deletion would be one less than it was before. 

-----Input-----
First line of the input contains a single integer T denoting number of test cases.
For each test case, you are given a single line containing string  s. 

-----Output-----
For each test case, print YES or NO depending on the answer of the problem. 

-----Constraints-----
Subtask 1, 35 points 
-  1 ≤ T ≤ 100
- 2 ≤  size of string s ≤ 1000
-  String s contains lowercase English alphabets (ie. from 'a' to 'z').

Subtask 2, 65 points 
- 2 ≤  size of string s ≤ 10^5
-  Sum of size of string s over all the input test cases won't exceed 10^6
-  String s contains lowercase English alphabets (ie. from 'a' to 'z').

-----Example-----
Input:
4
aaa
abc
abdbca
abba

Output:
YES
NO
YES
YES

-----Explanation-----
Example case 1. Delete any one 'a', resulting string is "aa" which is a palindrome.
Example case 2. It is not possible to delete exactly one character and having a palindrome.
Example case 3. Delete 'c', resulting string is "abdba" which is a palindrome. 
Example case 4. Delete 'b', resulting string is "aba" which is a palindrome.

```python

USER_FILENAME = "<user_code>"
import sys, json, builtins
import math, heapq, bisect, itertools, functools, collections, statistics, fractions, decimal, operator, array, random, re, string, os, pathlib
try:
    import resource as _res
except Exception:
    _res = None
from collections import Counter, defaultdict, deque, OrderedDict
from functools import lru_cache, reduce
from itertools import accumulate, permutations, combinations, product
from math import gcd, ceil, floor, sqrt
from decimal import Decimal
try:
    from typing import *
except Exception:
    pass
try:
    sys.setrecursionlimit(1_000_000)
except Exception:
    pass
try:
    import site as _site
    try:
        _sys_sites = _site.getsitepackages() if hasattr(_site, "getsitepackages") else []
        for _p in _sys_sites:
            if _p and _p not in sys.path:
                sys.path.append(_p)
    except Exception:
        pass
    try:
        _usp = _site.getusersitepackages()
        if isinstance(_usp, str):
            _usp = [_usp]
        for _p in _usp:
            if _p and _p not in sys.path:
                sys.path.append(_p)
    except Exception:
        pass
except Exception:
    pass

ns = {"__name__": "__main__"}
for _k, _v in list(globals().items()):
    if not _k.startswith("_"):
        ns[_k] = _v
_CODE = "def is_pal(s):\n if len(s)==1:\n  return 1\n else:\n  count=0\n  for i in range(int(len(s)/2)):\n   if s[i]==s[len(s)-1-i]:\n    count+=1\n  if count==int(len(s)/2):\n   return 1\n  else:\n   return 0\nt = int(input())\nfor i in range(t):\n count=0\n s = input()\n c = list()\n d = list()\n f = 0\n if is_pal(s):\n  print('YES')\n else:\n  for j in range(len(s)):\n   c.append(s[j])\n   d.append(s[j])\n  \n  n = len(s)\n  for j in range(n):\n   if s[j]!=s[n-j-1]:\n    c.pop(j)\n    x = is_pal(c)\n    if x==1:\n     f=1\n     break\n    else:\n     c.clear()\n     for i in range(len(d)):\n      c.append(d[i])\n     c.pop(n-j-1)\n     x = is_pal(c)\n     if x==1:\n      f=1\n      break\n     else:\n      c.clear()\n      for i in range(len(d)):\n       c.append(d[i])\n  if f==1:\n   print('YES')\n  else:\n   print('NO')\n"
_co = compile(_CODE, USER_FILENAME, "exec")
exec(_co, ns, ns)

```

Measured memory_bytes: 13849