#P7964. Kaučuk Command Parser
Kaučuk Command Parser
Kaučuk Command Parser
The Kaučuk program supports only the following three commands:
- $\texttt{section}$: Create a new level-1 title. The numbering starts from $1$.
- $\texttt{subsection}$: Create a new level-2 title. For each section, numbering starts at $1$, forming numbers like $1.1$, $1.2$, etc.
- $\texttt{subsubsection}$: Create a new level-3 title. For each subsection, numbering starts at $1$, forming numbers like $1.1.1$, $1.1.2$, etc.
Given $n$ commands along with their title names, output all title numbers together with their corresponding names.
inputFormat
The first line contains an integer $n$ representing the number of commands. Each of the following $n$ lines consists of a command (one of "section", "subsection", or "subsubsection") followed by a space and the title name. The title name may contain spaces.
outputFormat
For each command, output a single line with the title number and the title name separated by a space. The title number is generated according to the nesting rules:
- For a
section
command, output the section number (e.g.1
). - For a
subsection
command, output the section number, a dot, and the subsection number (e.g.1.1
). - For a
subsubsection
command, output the section number, a dot, the subsection number, another dot, and the subsubsection number (e.g.1.1.1
).
sample
3
section Introduction
subsection Background
subsubsection Details
1 Introduction
1.1 Background
1.1.1 Details
</p>