回答編集履歴
2
No need to fill s\[j\] by '\\0'\.
answer
CHANGED
@@ -10,7 +10,8 @@
|
|
10
10
|
j++;
|
11
11
|
}
|
12
12
|
}
|
13
|
-
s[j] = '\0';
|
14
13
|
s.resize(j);
|
15
14
|
}
|
16
|
-
```
|
15
|
+
```
|
16
|
+
|
17
|
+
Without resizing, this string is not null-terminating.
|
1
Fixed to be null-terminated string\.
answer
CHANGED
@@ -10,6 +10,7 @@
|
|
10
10
|
j++;
|
11
11
|
}
|
12
12
|
}
|
13
|
+
s[j] = '\0';
|
13
14
|
s.resize(j);
|
14
15
|
}
|
15
16
|
```
|