mirror of
https://git.sb/baoshuo/OI-codes.git
synced 2024-11-27 13:56:26 +00:00
16. 替换空格
https://www.acwing.com/problem/content/submission/code_detail/14064166/
This commit is contained in:
parent
352faa5ca0
commit
f491e2fc25
12
AcWing/16/16.cpp
Normal file
12
AcWing/16/16.cpp
Normal file
@ -0,0 +1,12 @@
|
|||||||
|
class Solution {
|
||||||
|
public:
|
||||||
|
string replaceSpaces(string &str) {
|
||||||
|
string res;
|
||||||
|
for (auto c : str)
|
||||||
|
if (c == ' ')
|
||||||
|
res += "%20";
|
||||||
|
else
|
||||||
|
res += c;
|
||||||
|
return res;
|
||||||
|
}
|
||||||
|
};
|
Loading…
Reference in New Issue
Block a user