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 1
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
1.1. Title of the first section of the first chapter
1.2. Title of the second section of the first chapter
...
Title of the second chapter
2.1. Title of the first section of the second chapter
2.2. 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 1 space.
For example, the input text is n=1 llines

Step by Step Solution

There are 3 Steps involved in it

1 Expert Approved Answer
Step: 1 Unlock blur-text-image
Question Has Been Solved by an Expert!

Get step-by-step solutions from verified subject matter experts

Step: 2 Unlock
Step: 3 Unlock

Students Have Also Explored These Related Databases Questions!