import java.util.*;
public class Solution { /** * 代码中的类名、方法名、参数名已经指定,请勿修改,直接返回方法规定的值即可 * * * @param s string字符串 * @return string字符串 */ public String replaceSpace (String s) { int size = s.length(); int index = 0; char[] ch = new char[size * 3]; // char[] s1 = s.toCharArray(); for(int i = 0;i < size; i++){ char c = s.charAt(i); if(c == ' '){ ch[index ++] = '%'; ch[index ++] = '2'; ch[index ++] = '0';
}else{
ch[index ++] = c;
}
}
String news = new String(ch,0,index);
return news;
// write code here
}
}