import java.io.*;

public class RemoveAha {

    public static void main (String [] args) throws IOException {
	// Setting up the reading:
	// Create a buffered reader
	BufferedReader in = new BufferedReader(
			new InputStreamReader(System.in));
	// to read a line of input, use in.readLine();

	// prompt the user:
	String input = in.readLine();
	String result = input.replaceAll("aha","");
	System.out.println("Aha! You meant");
	System.out.println(result);
	System.out.println("When you said");
	System.out.println(input);
    }

}


This is an example from CSci 1211 course.

The views and opinions expressed in this page are strictly those of the page author. The contents of this page have not been reviewed or approved by the University of Minnesota.