-
Notifications
You must be signed in to change notification settings - Fork 0
/
J03025.java
29 lines (28 loc) · 847 Bytes
/
J03025.java
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
import java.util.*;
public class J03025 {
public static void main(String[] args) {
Scanner in = new Scanner(System.in);
int t = Integer.parseInt(in.nextLine());
while (t-- > 0) {
String s = in.nextLine();
// int k = s.length();
// System.out.println(k);
int cnt = 0;
for (int i = 0; i <= (int)(s.length()/2); i++) {
if (s.charAt(i) != s.charAt(s.length() - i - 1)) {
cnt++;
}
}
if (s.length() % 2 == 1 && cnt == 0)
System.out.println("YES");
else {
if (cnt == 1)
System.out.println("YES");
else {
System.out.println("NO");
}
}
}
}
}
// abccaa