-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathTapRieng.java
More file actions
32 lines (29 loc) · 900 Bytes
/
Copy pathTapRieng.java
File metadata and controls
32 lines (29 loc) · 900 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
28
29
30
31
32
import java.util.*;
public class TapRieng {
public static Scanner in = new Scanner(System.in);
public static void testcase() {
List<String> s1 = Arrays.asList(in.nextLine().split(" "));
List<String> s2 = Arrays.asList(in.nextLine().split(" "));
LinkedHashSet<String> set = new LinkedHashSet<>();
for (String x : s1) {
set.add(x);
}
for (String x : s2) {
if (set.contains(x)) {
set.remove(x);
}
}
List<String> s3 = new ArrayList<>(set);
Collections.sort(s3);
for (String x : s3) {
System.out.print(x + " ");
}
System.out.println();
}
public static void main(String args[]) {
int t = Integer.parseInt(in.nextLine());
while (t-- > 0) {
testcase();
}
}
}