cswork / OA打开练习工作台

RobloxOA #4

Newspaper Paragraph Formatting

估计简单评测数据准备中,可先阅读题面

考点(AI 标注)字符串模拟/实现

You are formatting text for a newspaper page. Text is provided as an array paragraphs, where each paragraph is an array of "chunks". Each chunk has the form [type, content]:

  • type = "p": paragraph (plain text)
  • type = "bold": bold
  • type = "italic": italic
  • type = "underline": underline

For each paragraph, return its formatted HTML-like string. Bold → <b>...</b>, italic → <i>...</i>, underline → <u>...</u>. Wrap the entire paragraph in <p>...</p>. Nested formatting should produce nested tags in the order they were applied.

Example: paragraphs = [[["bold", "Hello"]]] → ["<p><b>Hello</b></p>"].