
import java.util.Scanner;
import java.io.File;
import java.io.FileNotFoundException;
import java.io.PrintWriter;

class Mar10 {
	public static void main(String[] args) {

		Scanner input = null;

		try {
			input = new Scanner(new File("num.txt"));
		}
		catch(FileNotFoundException e) {
			e.printStackTrace();
			System.out.println("You are not a failure, the Scanner is");
			return;
		}

		System.out.println("got here");
		
		// change delimiters
		input.useDelimiter(",|\n");         // use , and \n as delimiters
		//input.useDelimiter("\\||\n");     // use | and \n as delimiters
		//input.useDelimiter("\\\\|\n");    // use \ and \n as delimiters

		while(input.hasNext()) {
			String s = input.next();
			System.out.print(s + " ");
		}
		System.out.println();

		// Print to a file

		PrintWriter output = null;

		try {
			output = new PrintWriter(new File("output.txt"));
		}
		catch(FileNotFoundException e) {
			System.out.println("Unable to write to file");
			return;	
		}
		
		for(int i = 1; i <= 9; i++) {
			output.printf("%d ", i);
		}
		
		output.close();  // flush the buffer

	}
}
