#include <bits/stdc++.h>
using namespace std;
int main()
{
ios::sync_with_stdio(0);
cin.tie(0);
cout.tie(0);
int n;
cin>>n;
int cnt1=0,cnt2=0,cnt3=0;
while(n--){
string tip,word;
cin>>tip>>word;
if(tip=="section"){
++cnt1;
cnt2=0;
cnt3=0;
}
else
if(tip=="subsection"){
++cnt2;
cnt3=0;
}
else
++cnt3;
cout<<cnt1;
if(cnt2)
cout<<'.'<<cnt2;
if(cnt3)
cout<<'.'<<cnt3;
cout<<' ';
cout<<word<<'\n';
}
return 0;
}
# | 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... |