import java.util.*;

public class parser2
{
 public static void main(String argv[])
 {
	System.out.println("Content-type: text/plain");
	System.out.println("\n");

	if(argv.length == 0)
	{
	  System.out.println("No query string.");
	  System.exit(1);
	}	
	// this is a comment
	// two slashes tells the compiler
	// to ignore the rest of the line
	// If the program arrives at this
	// point, it means we have a QUERY_STRING 
	System.out.println("Your QUERY_STRING is:");
	System.out.println(argv[0]); 
	System.out.println("\n\nThe arguments are:\n");
        System.out.println(argv[0].replace('&',' '));

	System.out.println("\nNow use StringTokenizer:");

	StringTokenizer st; 

	st = new StringTokenizer(argv[0].replace('&',' '));

//	while( st.hasMoreTokens() ){
	 String myStr = new String(st.nextToken());	
	  System.out.println(st.nextToken());
	  System.out.println("Still in while loop...");
//	}
	
	st = new StringTokenizer(argv[0].replace('&',' '));

	System.out.println("\n");

	while( st.hasMoreTokens() ){ 
	  //since arg1= arg2= and arg3= all have five
	  //characters, we can strip them off by using
	  //the substring method, beginning w/index 5 
	  System.out.println(st.nextToken().substring(5));	    }
  }
}

