11438 - Implement a list 2 (back)   

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

You are required to implement a list.

Input

The input consist of a number of operations. Each operations (erase, insert and S) are separated by a newline character ('\n').

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

Operation pop_back: Pop a node at the end position.

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 pop_back) and operator<<(std::ostream &,const List &lst).

Sample Input  Download

Sample Output  Download

Partial Judge Code

11438.cpp

Partial Judge Header

11438.h

Tags




Discuss