Skip to content

Commit f6bddd4

Browse files
authored
Merge pull request #1531 from AlgorithmWithGod/0224LJH
[20251128] BOJ / G4 / 중복 제거 / 이종환
2 parents b5ee4ba + d3c166a commit f6bddd4

File tree

1 file changed

+48
-0
lines changed

1 file changed

+48
-0
lines changed
Lines changed: 48 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,48 @@
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+
```

0 commit comments

Comments
 (0)