Multiple Stack And Queue Cppreference Algorithmic Problem