/* * To change this template, choose Tools | Templates * and open the template in the editor. */ /** * * @author LH */ import java.io.*; import java.math.BigDecimal; import java.math.BigInteger; class InteractiveIO { private static BufferedReader br = new BufferedReader(new InputStreamReader( System.in));; public static void write(String s) throws Exception { writeAndFlush(s); } public static String promptAndRead(String s) throws Exception { writeAndFlush(s); return br.readLine(); } private static void writeAndFlush(String s) throws Exception { System.out.println(s); System.out.flush(); } public static int promptForInt(String s) throws Exception { return Integer.parseInt(promptAndRead(s.trim())); } public static long promptForLong(String s) throws Exception { return Long.parseLong(promptAndRead(s.trim())); } public static float promptForFloat(String s) throws Exception { return Float.parseFloat(promptAndRead(s.trim())); } public static double promptForDouble(String s) throws Exception { return Double.parseDouble(promptAndRead(s.trim())); } public static BigDecimal promptForBigDecimal(String s) throws Exception { return new BigDecimal(promptAndRead(s.trim())); } public static BigInteger promptForBigInteger(String s) throws Exception { return new BigInteger(promptAndRead(s.trim())); } }