import java.util.StringTokenizer;

/**
 * StringTok2 --- A simple program to show the String Tokenizer
 * @author         Matthew Sharritt
 */

public class StringTok2 {

  /**
   * Reads a String and shows the separate tokens, then the number of tokens left
   * @param arg A string array containing the command line arguments.
   * @return No return value.
   * @exception Exception If the file is not found or other error.
   */

  public static void main (String[] arg) throws Exception {
    StringTokenizer st = new StringTokenizer("this:is:a:test", ":");

    while (st.hasMoreTokens()) {
      System.out.println(st.nextToken());
      System.out.println("Number of Tokens Left: " + st.countTokens());
    }
  }
}

