이 제출은 이전 버전의 oj.uz에서 채점하였습니다. 현재는 제출 당시와는 다른 서버에서 채점을 하기 때문에, 다시 제출하면 결과가 달라질 수도 있습니다.
#include <bits/stdc++.h>
using namespace std;
#define int long long
#define fi first
#define se second
#define pb push_back
#define mp make_pair
#define foru(i, l, r) for(int i = l; i <= r; i++)
#define ford(i, r, l) for(int i = r; i >= l; i--)
#define __TIME  (1.0 * clock() / CLOCKS_PER_SEC)
typedef pair<int, int> ii;
typedef pair<ii, int> iii;
typedef pair<ii, ii> iiii;
 
const int N = 1e6 + 5;
 
const int oo = 1e18, mod = 1e9 + 7;
 
int n, m, k;
vector<int> arr;
void process() {
	// section, subsection, subsubsection
	cin >> n;
	int cntsec=0, cntsub=0, cntsubsub=0;
	foru(i,1,n) {
		string type, str;		
		cin >> type >> str;
		if (type=="section") {
			cntsec++;
			cntsub=0, cntsubsub=0;
			cout << cntsec << ' ' << str << '\n';
		} else if (type=="subsection") {
			cntsub++;
			cntsubsub=0;
			cout << cntsec << '.' << cntsub << ' ' << str << '\n';
		} else if (type=="subsubsection") {
			cntsubsub++;
			cout << cntsec << '.' << cntsub << '.' << cntsubsub << ' ' << str << '\n';
		}
	}
    return;
}
signed main() {
    cin.tie(0)->sync_with_stdio(false);
    //freopen(".inp", "r", stdin);
    //freopen(".out", "w", stdout);
    process();
    cerr << "Time elapsed: " << __TIME << " s.\n";
    return 0;
}
/*
Xét các trường hợp đặc biệt
Kiểm tra lại input/output
Cố gắng trâu
Lật ngược bài toán
Calm down and get VOI 
Stream of thought:
*/
| # | Verdict | Execution time | Memory | Grader output | 
|---|
| Fetching results... | 
| # | Verdict | Execution time | Memory | Grader output | 
|---|
| Fetching results... | 
| # | Verdict | Execution time | Memory | Grader output | 
|---|
| Fetching results... | 
| # | Verdict | Execution time | Memory | Grader output | 
|---|
| Fetching results... |