public class StringStack {
	public static final Integer MAX_STACK_DEPTH = 1000;
	
	private List<String> stack;
	
	public StringStack(){
		stack = new List<String>();
	}
	
	public void push(String s){ 
		if (s == null) { throw new NullValueNotAllowedException(); }
		if (this.isFull()) { throw new StackOverflowException(); }
		stack.add(s); 
	}
	
	public String pop() { 
		if (this.isEmpty()) { throw new StackUnderflowException(); }
		return stack.remove( lastItemIndex );
	}
	
	public String peak() { 
		if (this.isEmpty()) { throw new StackUnderflowException(); }
		return stack.get( lastItemIndex );
	}
	
	public Boolean isEmpty() { return stack.isEmpty(); }
	public Boolean isFull() { return MAX_STACK_DEPTH == stack.size(); }
	
	// Helper property
	private Integer lastItemIndex {
		get { return stack.size() - 1; }
	}
	
	public class NullValueNotAllowedException extends Exception {}
	public class StackOverflowException extends Exception {}
	public class StackUnderflowException extends Exception {}
}