import java.io.*;
public class Main {
public static void main(String[] args)throws Exception{
BufferedReader br = new BufferedReader(new InputStreamReader(System.in));
String str = “”;
while( (str = br.readLine()) != null){
System.out.println(str.replaceAll(" ", “%20”));
}
br.close();
}
}
/*
/**在java中,有 String str = “leetcode”;
* charAt(i) 函数 是获取字符串中i位置的字符
则 str.charAt(0) 为"l"
str.charAt(1) 为"e"
str.charAt(2) 为"e"
append()方法 相当于"+"
Stringbuffer其实是动态字符串数组
append()是往动态字符串数组添加,如“x”+“y”相当那个‘+’号
跟String不同的是Stringbuffer是放一起的
String1+String2 和Stringbuffer1.append("y")虽然打印效果一样,但在内存中表示却不一样
String1+String2 存在于不同的两个地址内存
Stringbuffer1.append(Stringbuffer2)是放在一起的
* @throws IOException
*/
/*public String replaceSpace(StringBuffer str) {
if(strnull) {
return null;
}
StringBuffer sbr=new StringBuffer();
for(int i=0;i<str.length();i++) {
if(str.charAt(i)’ ') {
sbr.append("%20");
}else {
sbr.append(str.charAt(i));
}
}
return sbr.toString();
}
*/