Design algorithm to generate the table of contents in a MS Word document. You are given a Word document with predefined style template. Your algorithm should be able to generate table of contents based on the style.
Check out your Company Bowl for anonymous work chats.