/**         Example of reading strings from the keyboard
 *          and breaking the input up into tokens
 */

import java.io.*;                         // The Java IO package
import java.util.*;                       // Java util package

public class KeyBoardInput {
    /* 
     *         Must include "throws IOException" in the definition
     *         of main
     */
    public static void main(String args[]) throws IOException {
	
	//       Open System.in (attached to the keyboard), as
	//       a BuffererReader.

	BufferedReader keyBoard = new BufferedReader(new 
	    InputStreamReader(System.in));
	String line;
	
	while(true) {
	    System.out.print("Type in a line : ");   // Simple prompt

	    line = keyBoard.readLine();              // Read the line

	    System.out.println("The typed line was : " + line);
	    /*
	     *                 Break line up with Scanner (Java 5 only)
	     *                 with defaults (white space) delimiters
	     */
	    Scanner scan = new Scanner(line);
	    int t = 0;

	    //               Loop through printing the tokens

	    while(scan.hasNext()) {
		String s = scan.next();
		System.out.println("Token " + t + " is : " + s);
		t++;
	    }

	}
    }
}
