Editorial for ECOO '21 P2 - DNA Derren

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.

Author: Riolku

Note that A is the only vowel. We can compare every pair of consecutive characters. If both are A, or neither are A, we need to insert a space. Otherwise, we should not.

The first subtask is intended to reward inefficient solutions that, for example, split the string and copy it. To implement this efficiently, we can simply loop through the string and output the spaces as we go, requiring no splitting or extra memory.


There are no comments at the moment.