import java.util.*;
import java.io.*;

public class IntList {

	public static void main(String[] args) {
		ArrayList<Integer> L = new ArrayList<Integer>();
		Scanner console = new Scanner(System.in);
		
		// the following input loop terminates when you enter 0
		System.out.print( ">>> ");
		boolean done = false;
		while (!done) {
			if (!console.hasNextInt())
				done = true;
			else {
				int x = console.nextInt();
				if (x == 0)
					done = true;
				else {
					L.add(x);
					System.out.println( ">>> ");
				}
			}
		}
		// Here is one output loop that  prints the list
		for (int x: L) 
			System.out.println(x);
		// Here is another output loop that prints the list.
		// Take your pick.
		for (int i = 0; i < L.size(); i++) {
			System.out.printf( "%2d: %d\n", i, L.get(i));
		}

	}

}
