#K9671. To-Do List Manager

    ID: 39082 Type: Default 1000ms 256MiB

To-Do List Manager

To-Do List Manager

You are required to implement a simple text-based to-do list manager. The application supports the following operations:

  • add <description>: Adds a new task with the given description if it does not already exist.
  • complete <description>: Marks the specified task as completed if it exists.
  • remove <description>: Removes the specified task from the list if it exists.
  • list: Prints the current tasks in the list.

When printing (via the list command), the tasks must be displayed in the following order: all uncompleted tasks in the order they were added, followed by all completed tasks (also in the order they were added). Each task should be printed in the format: description:status, where status is either uncompleted or completed. If there are no tasks at the time of a list command, output Empty instead.

In mathematical notation, if we denote the set of tasks by \(T\) and define two sequences \(U\) and \(C\) for uncompleted and completed tasks respectively, then the output ordering should be: \[ Output = U \mathbin{\Vert} C, \] where \(\Vert\) denotes sequence concatenation.

inputFormat

The first line contains an integer n (1 \(\leq n \leq 1000), the number of operations.

The next n lines each contain one of the commands below:

  • add <description>
  • complete <description>
  • remove <description>
  • list

Note: The description is a string without newline characters. All operations are case-sensitive.

outputFormat

Whenever a list command is encountered, output one line as follows:

  • If there is at least one task, print the tasks in order separated by a comma and a space ", ". Each task should be printed as description:status.
  • If there are no tasks, print Empty.

The program should process all commands in order and produce output for every list command.

## sample
7
add Buy groceries
add Go for a run
complete Buy groceries
list
remove Go for a run
list
list
Go for a run:uncompleted, Buy groceries:completed

Buy groceries:completed Buy groceries:completed

</p>