Import java.io.inputstreamreader;
Open class question 1 {
/**
* Programming will replace the substring "word" in the text input from the keyboard with the string "world" and delete all substrings "this".
* Program requirements: The program should include comments, and should explain the function and usage of variables.
*/
Public static void main(String[] args) {
buffered reader reader = new buffered reader(new InputStreamReader(
system . in));
String message = null// stores the string entered by the user.
Try {
while ((message = reader.readLine())! = null) {
//Print the string before processing.
System.out.println ("input string:"+message ");
//replace word with world.
message = message . replace all(" word "," world ");
//Replace it with blank.
message = message . replace all(" this "," ");
//Print the processed string.
System.out.println ("After processing:"+message);
}
Catch (exception e) {
e . printstacktrace();
System.out.println ("Exception occurred, program exits!" );
}
}
}