class Solution {
public:
/**
* @param string: An array of Char
* @param length: The true length of the string
* @return: The true length of new string
*/
int replaceBlank(char string[], int length) {
// Write your code here
char strmy[1000];
int tmp=0;
int i;
for(i=0;i<length;i++)
{
strmy[i]=string[i];
}
for(i=0;i<length;i++){
if(strmy[i]==' '){
string[i+tmp*2]='%';
string[i+tmp*2+1]='2';
string[i+tmp*2+2]='0';
tmp++;
}else
string[i+tmp*2]=strmy[i];
}
return i+tmp*2;
}
};
public:
/**
* @param string: An array of Char
* @param length: The true length of the string
* @return: The true length of new string
*/
int replaceBlank(char string[], int length) {
// Write your code here
char strmy[1000];
int tmp=0;
int i;
for(i=0;i<length;i++)
{
strmy[i]=string[i];
}
for(i=0;i<length;i++){
if(strmy[i]==' '){
string[i+tmp*2]='%';
string[i+tmp*2+1]='2';
string[i+tmp*2+2]='0';
tmp++;
}else
string[i+tmp*2]=strmy[i];
}
return i+tmp*2;
}
};