We read every piece of feedback, and take your input very seriously.
To see all available qualifiers, see our documentation.
There was an error while loading. Please reload this page.
1 parent fb0ec7a commit c45bd34Copy full SHA for c45bd34
bona1122/[week6]Set/Distinct_substrings/Distinct_substrings.js
@@ -0,0 +1,19 @@
1
+// https://www.acmicpc.net/problem/11478
2
+
3
+const filePath =
4
+ process.platform === "linux"
5
+ ? "/dev/stdin"
6
+ : require("path").join(__dirname, "input.txt")
7
+const input = require("fs").readFileSync(filePath).toString().trim()
8
+const log = console.log
9
10
+// 서로 다른 부분 문자열의 개수 출력하기
11
+// 길이는 1,000 이하.
12
+const set = new Set()
13
+for (let i = 0; i < input.length; i++) {
14
+ for (let j = i; j < input.length; j++) {
15
+ const sliced = input.slice(i, j + 1)
16
+ set.add(sliced)
17
+ }
18
+}
19
+log(set.size)
bona1122/[week6]Set/Distinct_substrings/input.txt
@@ -0,0 +1 @@
+ababc
0 commit comments