#C7292. Filter Completed Tasks

    ID: 51147 Type: Default 1000ms 256MiB

Filter Completed Tasks

Filter Completed Tasks

You are given a list of task strings. Each task string represents a task and may or may not indicate that the task is completed.

Your goal is to filter the list so that only the tasks that begin with the prefix \(\texttt{CompletedTask}\) remain in the output.

For example, given the list ["Task1", "CompletedTask1", "Task2", "CompletedTask2"], the output should be ["CompletedTask1", "CompletedTask2"].

Note: The prefix to check is exactly CompletedTask. If none of the tasks have this prefix, you should output nothing (an empty line).

inputFormat

The input is read from stdin and has the following format:

  • The first line contains an integer \(n\) which represents the number of tasks.
  • The following \(n\) lines each contain a task string.

For example:

4
Task1
Task2
CompletedTask1
CompletedTask2

outputFormat

The output should be printed to stdout as a single line containing the completed tasks separated by a space. If there are no completed tasks, print an empty line.

For example, if the completed tasks are "CompletedTask1" and "CompletedTask2", the output should be:

CompletedTask1 CompletedTask2
## sample
4
Task1
Task2
CompletedTask1
CompletedTask2
CompletedTask1 CompletedTask2

</p>