11677 - Implement a list 4 (back and remove)   

Description

You must follow the rules as below:

1. do not use any static variables

2. do not use any variables which is not inside a function

3. only new, operator new, delete and operator delete are allowed to allocate or deallocate memory

4. memory usage limit: 2048 byte

You are required to implement a list.

You have to enable C++11 in this problem. (e.g. "g++ -std=c++11 ...")

Input

The input consist of a number of operations. Each operations (push_back, remove and show) are separated by a newline character ('\n').

Operation push_back: following by a non-negative integer (insert value, 0<=insert value<20). Push a node at the end position with insert value.

Operation remove: following by a non-negative integer (remove value, 0<=insert value<20). Erase all nodes which data is equal to remove value. 

Operation show: print the value of all nodes in the list. Print a whitespace character (' ') after printing the value of nodes. If the list is empty, do not print anything.

Output

Implement List (constructor, destructor, push_back and remove) and operator<<(std::ostream &os,const List &lst).

Sample Input  Download

Sample Output  Download

Partial Judge Code

11677.cpp

Partial Judge Header

11677.h

Tags




Discuss