题解 | #替换空格#
替换空格
https://www.nowcoder.com/practice/0e26e5551f2b489b9f58bc83aa4b6c68
class Solution { public: string replaceSpace(string s) { string res; for(auto &e:s) { if(e==' ') { res+="%20"; } else { res+=e; } } return res; } };
替换空格
https://www.nowcoder.com/practice/0e26e5551f2b489b9f58bc83aa4b6c68
class Solution { public: string replaceSpace(string s) { string res; for(auto &e:s) { if(e==' ') { res+="%20"; } else { res+=e; } } return res; } };
相关推荐