import java.util.ArrayList; public class SimpleStack { private ArrayList elements; public SimpleStack() { elements = new ArrayList<>(); } public void push(T elem) { elements.add(elem); } public T pop() { return elements.remove(elements.size()-1); } public int size() { return elements.size(); } }