// Below is the interface for Iterator, which is already defined for you.
// **DO NOT** modify the interface for Iterator.
Iterator(const vector<int>& nums);
Iterator(const Iterator& iter);
// Returns the next element in the iteration.
// Returns true if the iteration has more elements.
class PeekingIterator : public Iterator {
PeekingIterator(const vector<int>& nums) : Iterator(nums) {
// Initialize any member here.
// **DO NOT** save a copy of nums and manipulate it directly.
// You should only use the Iterator interface methods.
flag= Iterator::hasNext();
right = Iterator::next();
// Returns the next element in the iteration without advancing the iterator.
// hasNext() and next() should behave the same as in the Iterator interface.
// Override them if needed.
flag = Iterator::hasNext();
right = Iterator::next();