File tree Expand file tree Collapse file tree 1 file changed +48
-0
lines changed
Expand file tree Collapse file tree 1 file changed +48
-0
lines changed Original file line number Diff line number Diff line change 1+ ``` java
2+
3+ import java.io.BufferedReader ;
4+ import java.io.IOException ;
5+ import java.io.InputStreamReader ;
6+ import java.util.ArrayList ;
7+ import java.util.Arrays ;
8+ import java.util.HashSet ;
9+ import java.util.List ;
10+ import java.util.StringTokenizer ;
11+
12+ public class Main {
13+
14+ static BufferedReader br = new BufferedReader (new InputStreamReader (System . in));
15+ static List<Integer > list = new ArrayList<> ();
16+ static StringBuilder sb = new StringBuilder ();
17+
18+ public static void main (String [] args ) throws IOException {
19+
20+ init();
21+ process();
22+ print();
23+
24+ }
25+
26+ private static void init () throws IOException {
27+ StringTokenizer st = new StringTokenizer (br. readLine());
28+ while (st. hasMoreTokens()) {
29+ list. add(Integer . parseInt(st. nextToken()));
30+ }
31+
32+ }
33+
34+ private static void process () throws IOException {
35+ HashSet<Integer > set = new HashSet<> ();
36+ for (int n: list) {
37+ if (set. contains(n)) continue ;
38+ sb. append(n). append(" " );
39+ set. add(n);
40+ }
41+ }
42+
43+ private static void print () {
44+ System . out. println(sb. toString());
45+ }
46+
47+ }
48+ ```
You can’t perform that action at this time.
0 commit comments