#K16156. Task Manager
Task Manager
Task Manager
You are given a series of operations to manage a simple task list. The system supports two types of operations:
addTask task
: Adds a new task named task with a default status of pending.markComplete task
: Marks the task named task as complete if it exists.
After processing all operations, you need to output each task along with its current status in the order they were added. The status should be printed in the format: task: status
, where status
is either pending
or complete
.
The operations follow the format:
(\texttt{command\ task})
where (\texttt{command}) is either (\texttt{addTask}) or (\texttt{markComplete}) and (\texttt{task}) is a string without spaces.
Make sure your solution reads from standard input (stdin) and writes to standard output (stdout).
inputFormat
The first line of input consists of an integer (n) which indicates the number of operations. The following (n) lines each contain one operation in the format described above.
Example: 4 addTask buy_groceries addTask clean_room addTask pay_bills markComplete clean_room
outputFormat
Print each task and its status on a new line in the order the tasks were added. The output format for each task is:
task: status
For the above input, the expected output is:
buy_groceries: pending clean_room: complete pay_bills: pending## sample
4
addTask buy_groceries
addTask clean_room
addTask pay_bills
markComplete clean_room
buy_groceries: pending
clean_room: complete
pay_bills: pending
</p>