class Solution {
public:
/**
* 代码中的类名、方法名、参数名已经指定,请勿修改,直接返回方法规定的值即可
*
*
* @param s string字符串
* @return string字符串
*/
string replaceSpace(string s) {
// write code here
string res="";
for(char c:s)
{
if(c!=' ') res+=c;
else res+="%20";
}
return res;
}
};
剑指数据结构-替换空格
最新推荐文章于 2022-10-27 19:38:33 发布