问题描述
解题思路
实现源码
class Solution {
public:
void replaceSpace(char *str,int length) {
char temp[999999];
int i = 0;
int j = 0;
while(i<length) {
if(str[i] != ' ') {
temp[j++] = str[i++];
}
else {
temp[j++] = '%';
temp[j++] = '2';
temp[j++] = '0';
i++;
}
}
strcpy(str,temp);
}
};