Submission #520373

#TimeUsernameProblemLanguageResultExecution timeMemory
520373Alex_tz307Kaučuk (COCI21_kaucuk)C++17
50 / 50
1 ms308 KiB
#include <bits/stdc++.h>

using namespace std;

void TestCase() {
  int n;
  cin >> n;
  int cnt1 = 0, cnt2 = 0, cnt3 = 0;
  for (int i = 1; i <= n; ++i) {
    string s, t;
    cin >> s >> t;
    if (s == "section") {
      ++cnt1;
      cnt2 = cnt3 = 0;
      cout << cnt1 << ' ' << t << '\n';
    } else if (s == "subsection") {
      ++cnt2;
      cnt3 = 0;
      cout << cnt1 << "." << cnt2 << ' ' << t << '\n';
    } else if (s == "subsubsection") {
      ++cnt3;
      cout << cnt1 << "." << cnt2 << "." << cnt3 << ' ' << t << '\n';
    }
  }
}

int main() {
  ios_base::sync_with_stdio(false);
  cin.tie(nullptr);
  int tests = 1;
  for (int tc = 1; tc <= tests; ++tc) {
    TestCase();
  }
  return 0;
}
#Verdict Execution timeMemoryGrader output
Fetching results...
#Verdict Execution timeMemoryGrader output
Fetching results...
#Verdict Execution timeMemoryGrader output
Fetching results...
#Verdict Execution timeMemoryGrader output
Fetching results...