Editorial for COCI '15 Contest 7 #1 Nizovi


Remember to use this editorial only when stuck, and not to copy-paste code from it. Please be respectful to the problem author and editorialist.
Submitting an official solution before solving the problem yourself is a bannable offence.

Let's assume that empty arrays don't exist. Then, for each character {, }, , and letter of the English alphabet, we can define a set of commands to execute:

  1. Character {:
    • Print { and a newline
    • Increase current indentation by 2
    • Indent
  2. Character }:
    • Print a newline
    • Decrease current indentation by 2
    • Indent
    • Print }
  3. Character ,:
    • Print , and a newline
    • Indent
  4. Letter c
    • Print c

Additionally, we'd need to check the case when an array is empty and equal to {}.


Comments

There are no comments at the moment.