Editorial for DMPG '19 B4 - Braille


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: AvaLovelace

We can hardcode the 27 translations as strings in an array. Then, for each character in the input, look up its index in the array (0-25 for the letters and 26 for the space) to find the corresponding translation. We must store three strings containing the 3 lines of the translation respectively, then output them at the end.

Typing in the translations can be made slightly easier by noticing that the top four squares repeat every 10 letters (with the exception of W).


Comments

There are no comments at the moment.