-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathmain.java
More file actions
27 lines (25 loc) · 723 Bytes
/
Copy pathmain.java
File metadata and controls
27 lines (25 loc) · 723 Bytes
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
import java.util.*;
public class main{
public static void main(String[] args) {
Scanner sc = new Scanner(System.in);
if(!sc.hasNextInt()) return;
int T = sc.nextInt();
while(T-->0){
int n = sc.nextInt();
String s = sc.next();
int res=0;
boolean inDiscord = false;
for (int i = 0; i < n/2; i++) {
if(s.charAt(i)!=s.charAt(n-1-i)){
if(!inDiscord){
res++;
inDiscord = true;
}
}else{
inDiscord = false;
}
}
System.err.println(res);
}
}
}