P29754 [洛谷] [COCI2021-2022#2] Kaučuk
普及-
题目描述

Problem Description

The Kaučuk program consists of only the following three types of commands:

  • section: Creates a new primary heading, numbered starting from 1.
  • subsection: Creates a new secondary heading, numbered starting from 1 under each primary heading.
  • subsubsection: Creates a new tertiary heading, numbered starting from 1 under each secondary heading.

Given \( n \) commands and their respective titles, output all the heading numbers along with their titles.

Input Format

The first line contains a positive integer \( n \), representing the number of commands.

The next \( n \) lines each contain a command name (section, subsection, or subsubsection) and a title. The title consists of no more than 20 lowercase English letters.

Output Format

Output \( n \) lines, each representing the heading number and its title.

Sample Input and Output

Sample Input #1

3
section zivotinje
section boje
section voce

Sample Output #1

1 zivotinje
2 boje
3 voce

Sample Input #2

4
section zivotinje
subsection macke
subsection psi
subsubsection mops

Sample Output #2

1 zivotinje
1.1 macke
1.2 psi
1.2.1 mops

Sample Input #3

4
section zivotinje
subsection psi
section voce
subsection ananas

Sample Output #3

1 zivotinje
1.1 psi
2 voce
2.1 ananas

Notes

Data Range and Constraints

This problem uses subtask-based testing.

  • Subtask 1 (10 pts): \( 1 \le n \le 3 \).
  • Subtask 2 (10 pts): Only contains section commands.
  • Subtask 3 (10 pts): Only contains section and subsection commands.
  • Subtask 4 (20 pts): No special restrictions.

For 100% of the data, \( n \le 100 \).

Translated from COCI 2021-2022 CONTEST #2 Task 1 Kaučuk.

This problem's score is set according to the original COCI, with a maximum of 50 points.

输入格式

见题面 Input 部分

输出格式

见题面 Output 部分

样例输入
3 section zivotinje section boje section voce
样例输出
1 zivotinje 2 boje 3 voce