Scanner stdin = new Scanner(new BufferedInputStream(System.in)); while(stdin.hasNext()) { System.out.println(stdin.nextLine()); }