回答編集履歴
2
No need to fill s\[j\] by '\\0'\.
test
CHANGED
@@ -22,10 +22,12 @@
|
|
22
22
|
|
23
23
|
}
|
24
24
|
|
25
|
-
s[j] = '\0';
|
26
|
-
|
27
25
|
s.resize(j);
|
28
26
|
|
29
27
|
}
|
30
28
|
|
31
29
|
```
|
30
|
+
|
31
|
+
|
32
|
+
|
33
|
+
Without resizing, this string is not null-terminating.
|
1
Fixed to be null-terminated string\.
test
CHANGED
@@ -22,6 +22,8 @@
|
|
22
22
|
|
23
23
|
}
|
24
24
|
|
25
|
+
s[j] = '\0';
|
26
|
+
|
25
27
|
s.resize(j);
|
26
28
|
|
27
29
|
}
|