剑指OFFER----面试题05.替换空格
链接:https://leetcode-cn.com/problems/ti-huan-kong-ge-lcof/
代码:
class Solution { public: string replaceSpace(string s) { string res; for (auto x: s) { if (x == ' ') res += "%20"; else res += x; } return res; } };
链接:https://leetcode-cn.com/problems/ti-huan-kong-ge-lcof/
class Solution { public: string replaceSpace(string s) { string res; for (auto x: s) { if (x == ' ') res += "%20"; else res += x; } return res; } };