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.
def is_pal(s):
 if len(s)==1:
  return 1
 else:
  count=0
  for i in range(int(len(s)/2)):
   if s[i]==s[len(s)-1-i]:
    count+=1
  if count==int(len(s)/2):
   return 1
  else:
   return 0
t = int(input())
for i in range(t):
 count=0
 s = input()
 c = list()
 d = list()
 for j in range(len(s)):
  c.append(s[j])
  d.append(s[j])
#     print(c)
#     print(d)
 for j in range(len(s)):
  c.pop(j)
  x = is_pal(c)
  if x==1:
   print('YES')
   break
  else:
#             print(c)
   count+=1
   c.clear()
   for i in range(len(d)):
    c.append(d[i])
#             print(c)
 if count==len(s):
  print('NO')
def is_pal(s):
 if len(s)==1:
  return 1
 else:
  count=0
  for i in range(int(len(s)/2)):
   if s[i]==s[len(s)-1-i]:
    count+=1
  if count==int(len(s)/2):
   return 1
  else:
   return 0
t = int(input())
for i in range(t):
 count=0
 s = input()
 c = list()
 d = list()
 for j in range(len(s)):
  c.append(s[j])
  d.append(s[j])
#     print(c)
#     print(d)
 for j in range(len(s)):
  c.pop(j)
  x = is_pal(c)
  if x==1:
   print('YES')
   break
  else:
#             print(c)
   count+=1
   c.clear()
   for i in range(len(d)):
    c.append(d[i])
#             print(c)
 if count==len(s):
  print('NO')