#include <bits/stdc++.h>
using namespace std;
//~ #define int long long
#define fr first
#define sc second
#define pb push_back
#define endl "\n"
#define all(x) x.begin(),x.end()
#define sp << " " <<
#define inf 1e18+1
#define N 10000
#define fast ios_base::sync_with_stdio(false);cin.tie(NULL);cout.tie(NULL);cout<<fixed<<setprecision(0)
 
mt19937 rng(chrono::steady_clock::now().time_since_epoch().count());
typedef tuple<int,int,int> tiii;
typedef pair<int,int> pii;
void solve(){
	int n;
	cin >> n;
	int x=0,y=0,z=0;
	for(int i=0;i<n;i++){
		string t,s;
		cin >> t >> s;
		if(t=="section"){
			x++;y=0;z=0;
			printf("%d ",x);
			cout << s << endl;
		}
		if(t=="subsection"){
			y++;z=0;
			printf("%d.%d ",x,y);
			cout << s << endl;
		}
		if(t=="subsubsection"){
			z++;
			printf("%d.%d.%d ",x,y,z);
			cout << s << endl;
		}
	}
}     
int32_t main(){
	//~ freopen("a.txt","r",stdin);
	//~ fast;
	int test=1;
	//~ cin >> test;
	while(test--) solve();
}
| # | 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... |