#include <stdio.h>
#include<string.h>
int main( void ) {
long long int t,n,l,j,i,k,m;
char a[ 100011 ] ;
scanf ( "%lld" ,& t) ;
while ( t-- ) {
k= 0 ;
scanf ( "%s" ,a) ;
l= strlen ( a) ;
i= 0 ;
j= l- 1 ;
m= 0 ;
while ( i<= j) {
if ( a[ i] == a[ j] ) {
i++ ; j-- ;
}
else {
m++ ;
if ( m> 1 ) break ;
if ( ( a[ i+ 1 ] == a[ j] ) && ( ( i+ 2 >= j- 1 ) || a[ i+ 2 ] == a[ j- 1 ] ) ) {
i++ ;
}
else if ( ( a[ i] == a[ j- 1 ] ) && ( ( j- 2 >= i+ 1 ) || a[ j- 2 ] == a[ i+ 1 ] ) ) {
j-- ;
}
else {
m++ ;
}
}
}
if ( m<= 1 ) {
printf ( "YES - %s\n " , a) ;
}
else printf ( "NO\n " ) ;
}
// your code goes here
return 0 ;
}
I2luY2x1ZGUgPHN0ZGlvLmg+CiNpbmNsdWRlPHN0cmluZy5oPgoKaW50IG1haW4odm9pZCkgewoJbG9uZyBsb25nIGludCB0LG4sbCxqLGksayxtOwoJY2hhciBhWzEwMDAxMV07CglzY2FuZigiJWxsZCIsJnQpOwoJd2hpbGUodC0tKXsKCQlrPTA7CgkJc2NhbmYoIiVzIixhKTsKCQlsPXN0cmxlbihhKTsKCQlpPTA7CgkJaj1sLTE7CgkJbT0wOwoJCXdoaWxlKGk8PWopewoJCQlpZihhW2ldPT1hW2pdKXsKCQkJCWkrKztqLS07CgkJCX0KCQkJZWxzZXsKCQkJCW0rKzsKCQkJCWlmKG0+MSkgYnJlYWs7CgkJCQlpZigoYVtpKzFdPT1hW2pdKSAmJiAoKGkrMj49ai0xKXx8YVtpKzJdPT1hW2otMV0pKXsKCQkJCQlpKys7CgkJCQl9CgkJCQllbHNlIGlmKChhW2ldPT1hW2otMV0pICYmICgoai0yPj1pKzEpfHxhW2otMl09PWFbaSsxXSkpewoJCQkJCWotLTsKCQkJCX0KCQkJCWVsc2V7CgkJCQkJbSsrOwoJCQkJfQoJCQl9CgkJfQoJCWlmKG08PTEpewoJCQlwcmludGYoIllFUyAtICVzXG4iLCBhKTsKCQl9CgkJZWxzZSBwcmludGYoIk5PXG4iKTsKCX0KCS8vIHlvdXIgY29kZSBnb2VzIGhlcmUKCXJldHVybiAwOwp9Cg==
stdin
NTkKWDAxMAowWDEwCjAxWDAKMDEwWApYMDExMAowWDExMAowMVgxMAowMTFYMAowMTEwWApZWDAxMApYWTAxMApYMFkxMApYMDFZMApYMDEwWQpZMFgxMAowWVgxMAowWFkxMAowWDFZMAowWDEwWQpZMDFYMAowWTFYMAowMVlYMAowMVhZMAowMVgwWQpZMDEwWAowWTEwWAowMVkwWAowMTBZWAowMTBYWQpZWDAxMTAKWFkwMTEwClgwWTExMApYMDFZMTAKWDAxMVkwClgwMTEwWQpZMFgxMTAKMFlYMTEwCjBYWTExMAowWDFZMTAKMFgxMVkwCjBYMTEwWQpZMDFYMTAKMFkxWDEwCjAxWVgxMAowMVhZMTAKMDFYMVkwCjAxWDEwWQpZMDExWDAKMFkxMVgwCjAxWTFYMAowMTFZWDAKMDExWFkwCjAxMVgwWQpZMDExMFgKMFkxMTBYCjAxWTEwWAowMTFZMFgKMDExMFlYCjAxMTBYWQ==
59
X010
0X10
01X0
010X
X0110
0X110
01X10
011X0
0110X
YX010
XY010
X0Y10
X01Y0
X010Y
Y0X10
0YX10
0XY10
0X1Y0
0X10Y
Y01X0
0Y1X0
01YX0
01XY0
01X0Y
Y010X
0Y10X
01Y0X
010YX
010XY
YX0110
XY0110
X0Y110
X01Y10
X011Y0
X0110Y
Y0X110
0YX110
0XY110
0X1Y10
0X11Y0
0X110Y
Y01X10
0Y1X10
01YX10
01XY10
01X1Y0
01X10Y
Y011X0
0Y11X0
01Y1X0
011YX0
011XY0
011X0Y
Y0110X
0Y110X
01Y10X
011Y0X
0110YX
0110XY