-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathJ03009.java
More file actions
39 lines (36 loc) · 1.14 KB
/
J03009.java
File metadata and controls
39 lines (36 loc) · 1.14 KB
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
30
31
32
33
34
35
36
37
38
39
package CODE_PTIT;
import java.awt.BorderLayout;
import java.lang.*;
import java.util.*;
public class J03009 {
public static void main(String[] args) {
Scanner inp = new Scanner(System.in);
int t = Integer.parseInt(inp.nextLine());
while (t-- > 0) {
Map<String, Integer> map = new HashMap<>();
String s1 = inp.nextLine();
String s2 = inp.nextLine();
String tmp[] = s1.split("\\s+");
String res[] = s2.split("\\s+");
for (String x : res) {
if (x.length() > 0) {
map.put(x, 1);
}
}
List<String> list = new ArrayList<String>();
for (String x : tmp) {
if (x.length() > 0) {
if(!map.containsKey(x)){
list.add(x);
map.put(x, 1);
}
}
}
Collections.sort(list);
for(String x : list){
System.out.print(x + " ");
}
System.out.println();
}
}
}