import java.io.*;

public class SimpleIO
{
	public void printPrompt(String prompt)
	{

		System.out.print(prompt);

	}

	public String readLine(String prompt)
	{
		printPrompt(prompt);
		return readLine();
	}

	public String readLine()
	{
		int ch;
		String line ="";
		boolean done = false;
		while (!done)
		{
			try
			{
				ch = System.in.read();
				if (ch < 0 || (char)ch == '\n')
					done = true;
				else if ((char)ch != '\r')
					line = line + (char)ch;
			}
			catch (IOException e)
			{
				done = true;
			}
		}
		return line;
	}

	public int readInt(String prompt)
	{
		while (true)
		{
			printPrompt(prompt);
			try
			{
				return Integer.parseInt (readLine().trim());
			}
			catch (NumberFormatException e)
			{
				System.out.println("Not an integer. Please try again!");
			}
		}
	}

	public double readDouble(String prompt)
	{
		while (true)
		{
			printPrompt(prompt);
			try
			{
				return Double.parseDouble(readLine().trim());
			}
			catch (NumberFormatException e)
			{
				System.out.println("Not a double. Please try again!");
			}
		}
	}


}