Implement SetOfStacks

Problem

Implement a data structure SetOfStacks. SetOfStacks should be composed of several stacks and should create a new stack once the previous one exceeds capacity. SetOfStacks.push() and .pop() should behave identically to a single stack.

How to Solve

In order to control if we should create a new stack or not, we define the capacity of stack as a member in stack class.

Source Code