import java.io.*; import java.text.*; public class strings4 {//make love not war public static void main(String [] args) throws IOException { String text; String new_text1, new_text2; BufferedReader in =new BufferedReader (new InputStreamReader(System.in)); System.out.println("Please enter a line of text:"); text=in.readLine(); int position=text.indexOf("hate"); new_text1=text.substring(0,position); new_text2=text.substring(position+4,text.length()); System.out.println("First part of the string is: "+ new_text1); System.out.println("Second part of the string is: " +new_text2); System.out.println(new_text1+"love"+new_text2); } }