#K83457. Task Manager

    ID: 36201 Type: Default 1000ms 256MiB

Task Manager

Task Manager

You are tasked with implementing a simple task manager that processes a series of commands. There are three types of operations:

  • add <task_id> <description>: Adds a new task with the given ID and description. If the task ID already exists, the command is ignored.
  • delete <task_id>: Deletes the task with the specified task ID. If the task does not exist, the command is ignored.
  • list: Outputs the current list of tasks in the order they were added. Each task is output on a new line in the format <task_id> <description>.

The input terminates when the command end is encountered.

Note: For every list command encountered, the program should output the current tasks (one per line) that have not been deleted. Tasks remain in the order they were added. Even if a task is deleted, it is removed from the ordering.

For example, consider the commands:

add T1 Task One
add T2 Task Two
delete T1
add T3 Task Three
list
delete T2
list
end

The first list will output:

T2 Task Two
T3 Task Three

and the second list will output:

T3 Task Three

The overall output will be the concatenation of these outputs in order.

In mathematical terms, if we denote the function for the task manager as f(commands), then:

\( f(\langle add\ T1\ Task\ One,\ add\ T2\ Task\ Two,\ delete\ T1,\ add\ T3\ Task\ Three,\ list,\ delete\ T2,\ list,\ end \rangle) = \langle T2\ Task\ Two,\ T3\ Task\ Three,\ T3\ Task\ Three \rangle \)

inputFormat

The input consists of multiple lines. Each line contains one command. The commands can be:

  • add <task_id> <description>
  • delete <task_id>
  • list
  • end (indicating the end of input)

Read input from stdin.

outputFormat

For each list command encountered in the input, output the current list of tasks to stdout. Each task is printed on a new line in the format <task_id> <description>. There is no additional output.

## sample
add T1 First Task
add T2 Second Task
list
end
T1 First Task

T2 Second Task

</p>