import java.util.*; // needed for Scanner
import java.io.*;  // needed for File
/**
  This class is designed to illustrate how one can pick up data
  from a file and separate out the integers from the non-integers
  It also treats each line of the input file as a separate entity.

  @author Elizabeth Adams
  @version 1.0
*/

public class Demo
{
   public static void main (String [] args)
	{
	
	   Scanner fileScanner, lineScanner;
		String  oneLine;    // holds a single line from a file
		String  junk;       // holds non-integers from file
		int     number;     // holds integers from file
		

		fileScanner = null;
		try  // open the file
		{
		  fileScanner = new Scanner (new File("input.txt"));
		}
		catch (FileNotFoundException fnfe)
		{
		    System.out.println (" file wasn't in directory ");
		}  

		oneLine = null;
      do  // get a line from file
	   {
		   oneLine = fileScanner.nextLine();
         System.out.println (oneLine);  // debug
  	    	lineScanner = new Scanner(oneLine);
		   while (lineScanner.hasNext())
		   {
		     if (lineScanner.hasNextInt()) // is it an integer
		     {  
			    number = lineScanner.nextInt(); 
				 System.out.print (number + "  ");  // debug
		     }// end if
			else									// if not it's junk
			{
			   junk  = lineScanner.next();  
			   System.out.print (junk + "  "); // debug
		   }// end else
		}// end while processing of single line
		System.out.println();
	 } while (fileScanner.hasNextLine()); // while more lines in file	
	}// end main
} // end class
		