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:

  • section\texttt{section}: Create a new level-1 heading, numbered starting from 11.
  • subsection\texttt{subsection}: Create a new level-2 heading, numbered starting from 11 under each level-1 heading.
  • subsubsection\texttt{subsubsection}: Create a new level-3 heading, numbered starting from 11 under each level-2 heading.

Given nn commands and heading names, output the numbering of all headings and their names.

Input Format

The first line contains a positive integer nn, indicating the number of commands.

The next nn lines each contain a command name (one of section\texttt{section}, subsection\texttt{subsection}, subsubsection\texttt{subsubsection}) and a heading name. The heading name consists of at most 2020 lowercase English letters.

Output Format

Output nn 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): 1n31 \le n \le 3.
  • Subtask 2 (10 pts): Only section\texttt{section} commands.
  • Subtask 3 (10 pts): Only section\texttt{section} and subsection\texttt{subsection} commands.
  • Subtask 4 (20 pts): No special restrictions.

For 100%100\% of the data, n100n \le 100.

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 5050.

Translated by ChatGPT 5