luogu#P7964. [COCI 2021/2022 #2] Kaučuk
[COCI 2021/2022 #2] Kaučuk
Problem Description
The Kaučuk program has only the following three commands:
- : Create a new level-1 heading, numbered starting from .
- : Create a new level-2 heading, numbered starting from under each level-1 heading.
- : Create a new level-3 heading, numbered starting from under each level-2 heading.
Given commands and heading names, output the numbering of all headings and their names.
Input Format
The first line contains a positive integer , indicating the number of commands.
The next lines each contain a command name (one of , , ) and a heading name. The heading name consists of at most lowercase English letters.
Output Format
Output lines in total, representing the numbering of all headings and their names.
3
section zivotinje
section boje
section voce
1 zivotinje
2 boje
3 voce
4
section zivotinje
subsection macke
subsection psi
subsubsection mops
1 zivotinje
1.1 macke
1.2 psi
1.2.1 mops
4
section zivotinje
subsection psi
section voce
subsection ananas
1 zivotinje
1.1 psi
2 voce
2.1 ananas
Hint
Constraints
This problem uses bundled subtasks.
- Subtask 1 (10 pts): .
- Subtask 2 (10 pts): Only commands.
- Subtask 3 (10 pts): Only and commands.
- Subtask 4 (20 pts): No special restrictions.
For of the data, .
Hints and Notes
This problem is translated from COCI 2021-2022 CONTEST #2 Task 1 Kaučuk.
The score of this problem follows the original COCI setting, with a full score of .
Translated by ChatGPT 5