// An instance of List represents a list of String values
public class List {
// The items in the list are in items[0..no-1], and
// 0 <= no <= maxno = items.length,    and
// elements of items[0..no-1] are distinct
private int no;
private int maxno;
private String[] items;

// Constructor: an instance with an empty list of at most
// 300 elements
public List ( ){
	maxno= 300;
	no= 0;
	items= new String[maxno];
	}

// Constructor: an instance with an empty list of at most
// n elements
public List (int n ){
	maxno= n;
	no= 0;
	items= new String[maxno];
	}

// Set the list of String values to empty
public void Empty ( )
	{no= 0;}

// return the number of elements in the list
public int size( )
	{return no;}

// return "n is in the list"
public boolean isIn(String n) {
	int i= 0;
	// invariant: n is not in items[0..i-1]
	while (i <no && !n.equals(items[i]) )
		{i= i+1;}
	return i < no;
	}

// Add n to the list if it is not there
public void add (String n) {
	if  (isIn(n))   return;
	if  (no < maxno)
		{items[no]= n; no= no+1;}
	else System.out.println("Error. no space in list");
	}

// Return index of item n in list --return no if not there
private int placeOf (String n) {
	int i= 0;
	// invariant: n is not in items[0..i-1]
	while (i < no && ! n.equals(items[i]))
		i= i+1;
	return i;
	}

// Delete n from the list (if it is there)
public void  delete(String n) {
	int i= placeOf(n);
	if (i==no)  return;
	// Put items[no-1] in the hole left by items[i]
			items[i]= items[no-1];
	no= no-1;
	}

// Return a String representation of the list --the items
// separated by commas, with the whole list in
// parentheses
public String toString( ) {
	if (no==0)
		{return "( )";}
	int i= 1;
	String s= "(" + items[0];
	// Invariant: s contains the beginning of the desired
	// list up to and including items[i-1]
	while (i < no) {
		s=  s + ", " + items[i];
		i= i+1;
		}
	return s + ")";
	}

}