-- Homework 26, challenge -- solution.

local stack = { items = {} }

function stack:push(v)
    table.insert(self.items, v)
end

function stack:pop()
    return table.remove(self.items)
end

function stack:peek()
    return self.items[#self.items]
end

function stack:size()
    return #self.items
end

stack:push("a")
stack:push("b")
stack:push("c")
print(stack:size())    -- 3
print(stack:peek())    -- c
print(stack:pop())     -- c
print(stack:pop())     -- b
print(stack:size())    -- 1
