Build a Task and Subtask Hierarchy from Unordered Records

Given an arbitrarily ordered collection of task and subtask records, build and print the task hierarchy.

Each input record is one of the following:

  • TASK <task_id> <name>: a parent task.
  • `S...

Example

Unlock to view complete problem details

and practice with sample input/output

Was this article helpful?

View Test Cases & Run Code requires membership

Standard Input
Execution Result: