Question: Question 1 Create a table of contents for a simple markup language. It must follow two rules: If a line starts with a single |
Question
Create a table of contents for a simple markup language. It must follow two rules:
If a line starts with a single followed by a space, then it's a chapter title.
If a line starts with a double if followed by a space, then it's a section title.
The table of contents should be displayed in the following format:
Title of the first chapter
Title of the first section of the first chapter
Title of the second section of the first chapter
Title of the second chapter
Title of the first section of the second chapter
Title of the second section of the second chapter
Note that each number is followed by a period and the last period is followed by space.
For example, the input text is llines
Step by Step Solution
There are 3 Steps involved in it
1 Expert Approved Answer
Step: 1 Unlock
Question Has Been Solved by an Expert!
Get step-by-step solutions from verified subject matter experts
Step: 2 Unlock
Step: 3 Unlock
