-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathIcpc.java
More file actions
25 lines (25 loc) · 773 Bytes
/
Icpc.java
File metadata and controls
25 lines (25 loc) · 773 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
import java.util.*;
public class Icpc {
public static void main(String[]args){
Scanner sc = new Scanner(System.in);
if(sc.hasNextInt()){
int t = sc.nextInt();
while(t-->0){
int n = sc.nextInt();
String s = sc.next();
HashMap<Character, Boolean> mpp = new HashMap<>();
int ttl = 0;
for(int i=0; i<n; i++){
char prblm = s.charAt(i);
if(mpp.containsKey(prblm)){
ttl+=1;
}else{
ttl+=2;
mpp.put(prblm, true);
}
}
System.out.println(ttl);
}
}
}
}