IBMOA #70
Table of Contents
估计简单可在线判题
考点(AI 标注)字符串模拟/实现
A line that starts exactly with "# " is a chapter title, a line that starts with "## " is a section title, and all other lines are ignored. Chapters are numbered from 1, and section numbers restart from 1 in each new chapter; output "<chapter>. <title>" or "<chapter>.<section>. <title>". Only the fixed prefix is removed; all whitespace and Unicode characters within the title are kept as is, and empty titles are allowed.
输入格式
The input is a JSON array of strings text. Full original bounds: 1≤number of lines≤1000, and each string has length 1..100 in Unicode code points; the first line is guaranteed to start with "# ". A leading # marker is only # or ## and is followed by a space. The original text does not restrict the character set, so it is not narrowed to ASCII; JSON escapes may represent control characters such as tabs, and title content is not trimmed.
输出格式
Output a single-line canonical JSON array of strings, followed by a newline: one space after each comma in the array; non-ASCII characters are output directly; double quotes, backslashes and control characters are escaped per JSON (backspace/tab/newline/form feed/carriage return use \b/\t/\n/\f/\r, and the remaining U+0000..U+001F use lowercase four-digit \u00xx); slashes are not escaped. This matches Python json.dumps(result, ensure_ascii=False). This encoding preserves every title character and avoids NUL in the output; an exact check is used.
样例 1
输入:
["# Cars", "ignored", "## Sedan", "## Coupe", "## SUV"]
输出:
["1. Cars", "1.1. Sedan", "1.2. Coupe", "1.3. SUV"]
样例 2
输入:
["# A", "## B", "# C", "## D"]
输出:
["1. A", "1.1. B", "2. C", "2.1. D"]
样例 3
输入:
["# 标题 ", "## \t子节 ", " # ignored", "# "]
输出:
["1. 标题 ", "1.1. \t子节 ", "2. "]
样例说明
The first example outputs ["1. Cars", "1.1. Sedan", "1.2. Coupe", "1.3. SUV"]. In the second example, section numbers reset after a new chapter. In the third example, the titles contain spaces, tabs and an empty title; after JSON decoding, the titles must be preserved character by character.