Jia Tse www.egr.unlv.edu/~jjtse static String readLine() throws Exception{ /* * this function reads a line from stdin and returns the string * if EOF, return "EOF" */ StringBuffer s = new StringBuffer(""); int b = 0; while (b != '\n' && b >= 0){ b = System.in.read(); if (b == -1 && s.length() == 0) return ("EOF"); if (b != '\r' && b != '\n' && b >=0 ) s.append((char)b); } return s.toString(); }