/**
 * Extends Stack by adding methods size, search and find.
 * Also specifies the toString format.
 */
public interface SearchableStack<E> extends Stack<E> {

    /**
     * Return whether o is in this stack.
     * @param o  the object to search for, using equals
     * @return  whether at least one element in this stack equals o.
     */
  boolean search(E o);

    /**
     * Return and remove the first occurrence (counting from the top) of o from this stack.
     * Precondition: search(o) -- that is, an element in this stack equals o.
     * @param o  the object to search for and remove
     * @return  the first (counting from the top) element (formerly) in this stack that equals o.
     */
  E find(E o);

    /**
     * Return the number of elements in this stack.
     * @ return  the number of elements in this stack
     */
  int size();

    /**
     * Return a string representation of this stack.
     * @return  the string representations of the elements, starting from the top,
     *           one per line with each line ending in "\n"
     */
  String toString();
}

