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 3b1331c commit 98f101eCopy full SHA for 98f101e
live12/test124/문제1/황장현.js
@@ -0,0 +1,34 @@
1
+const input = require('fs')
2
+ .readFileSync(process.platform === 'linux' ? '/dev/stdin' : './input.txt')
3
+ .toString()
4
+ .trim()
5
+ .split('\n');
6
+
7
+const S = input[0];
8
+const P = input[1];
9
10
+let index = 0;
11
+let count = 0;
12
13
+while (index < P.length) {
14
+ let maxLen = 0;
15
16
+ for (let j = 0; j < S.length; j++) {
17
+ let temp = 0;
18
+ while (
19
+ index + temp < P.length &&
20
+ j + temp < S.length &&
21
+ P[index + temp] === S[j + temp]
22
+ ) {
23
+ temp++;
24
+ }
25
+ if (temp > maxLen) {
26
+ maxLen = temp;
27
28
29
30
+ index += maxLen;
31
+ count++;
32
+}
33
34
+console.log(count);
0 commit comments