SierraOA #1
Markdown Header Chunks
估计中等可在线判题
考点(AI 标注)字符串模拟/实现
Split Markdown by whole lines; if a new chunk starts in the middle of some header level, first replay the currently active header path. For display, lines are joined with |.
The standard input/output format and supplementary bounds of this site are as stated in this problem.
输入格式
The first line contains maxChunkSize (1≤value≤10^5), followed by the raw Markdown text; lines cannot be split, and the total input length is ≤10^5. An overlong content line forms a chunk on its own, but still carries the active headers.
输出格式
Output one line per chunk, with its internal lines joined by |; an empty document produces empty output.
样例 1
输入:
20
# A
short
longer line
## B
x
y
输出:
# A | short
# A | longer line
# A | ## B | x | y
样例 2
输入:
30
# Guide
alpha
beta
输出:
# Guide | alpha | beta
样例 3
输入:
10
# X
very long line here
输出:
# X
# X | very long line here