String str = null;
PrintWriter out = new PrintWriter(System.out);
while(true){
BufferedReader in = new BufferedReader(new InputStreamReader(System.in));
str = in.readLine();
if(str.lastIndexOf("end")!=-1){
if(str.lastIndexOf("end")!=0)
out.println(str.substring(0,str.lastIndexOf("end")));
break;
}else{
out.println(str);
}
out.flush();
 }
 
 out.close();

解决方案 »

  1.   

    详细如下:import java.io.*;
    public class Zuoye{
    public static void main(String args[])throws IOException{
    String str = null;
    PrintWriter out = new PrintWriter(System.out);
    while(true){
    BufferedReader in = new BufferedReader(new InputStreamReader(System.in));
    str = in.readLine();
    if(str.lastIndexOf("end")!=-1){
    if(str.lastIndexOf("end")!=0)
    out.println(str.substring(0,str.lastIndexOf("end")));
    break;
    }else{
    out.println(str);
    }
    out.flush();
     }
     
     out.close();
    }
    }
      

  2.   

    简单如下:import java.io.*;
    public class Zuoye{
    public static void main(String args[])throws IOException{
    String str = null;
    PrintWriter out = new PrintWriter(System.out);
    while(true){
    BufferedReader in = new BufferedReader(new InputStreamReader(System.in));
    str = in.readLine();
    out.println(str);
    out.flush();
     }  
     out.close();
    }
    }
      

  3.   

    >>>>也就是不按回车即能读入使用
        如何确认输入完毕?
      

  4.   

    >>>>也就是不按回车即能读入使用
        如何确认输入完毕?
    那你怎么知道什么时候输玩了?