exercise 3.23 deque