import java.util.*;

public class room {

	public static void main(String[] args) {

		Scanner stdin = new Scanner(System.in);
		ArrayList<String> curList = new ArrayList<String>();

		// Get the user's first choice.
		menu();
		int choice = stdin.nextInt();

		// Continue until the user quits.
		while (choice != 4) {

			// Add a person.
			if (choice == 1) {
				System.out.println("Who is entering the room?");
				String person = stdin.next();
				curList.add(person);
			}

			// Remove a person.
			else if (choice == 2) {

				// First print out the list of the people in the room.
				System.out.println("Here is a list of who is in the room?");
				for (int i=0; i<curList.size(); i++)
					System.out.println((i+1)+". "+curList.get(i));

				// Now get who is leaving.
				System.out.println("Please enter the number of the student leaving the room.");
				int id = stdin.nextInt();

				// Some minor error checking.
				if (id < 1 || id > curList.size())
					System.out.println("Sorry, that's not a valid student to leave the room.");

				// Execute the remove.
				else {
					String gone = curList.remove(id-1);
					System.out.println(gone+" has been removed from the room.");
				}
			}

			// Print the roster.
			else if (choice == 3) {
				System.out.println("Here is a list of who is in the room?");
				for (int i=0; i<curList.size(); i++)
					System.out.println((i+1)+". "+curList.get(i));
			}

			// Minor error checking.
			else if (choice != 4) {
				System.out.println("Sorry, you made an invalid choice.");
			}

			// Get the user's next choice.
			menu();
			choice = stdin.nextInt();
		}

	}

	// Prints a menu of choices.
	public static void menu() {
		System.out.println("Please make a selection from the following choices.");
		System.out.println("1. A student enters the room.");
		System.out.println("2. A student leaves the room.");
		System.out.println("3. Print a current roster of the room.");
		System.out.println("4. Quit.");
	}
}