GK - G Key

no tags 

Leandro and Fede are traveling by train and to spend some time they decided to start playing
the guitar. They want to play together some songs, but Fede’s memory is not working well
because he caught a little cold. To work it out, Leandro wants to show to Fede some music
scores of several punk rock songs. A punk rock song is a sequence of notes, and there are twelve
possible notes, divided in two groups. The first group has seven natural notes called A, B, C,
D, E, F and G, while the second group has five alterations called A#, C#, D#, F# and G#.
The way to draw a music score is as follows: you start with an empty one, and then you draw
note by note from left to right in the same order they appear in the song. In the following
picture you can see an empty music score with two lines. The symbol at the beginning of each
line is called G key. Each line is divided in four groups, each group having room for four notes.

In this figure, the song “E, F, F#, G, G#, A, A#, B, C, C#, D, D#” is depicted.

Can you help Leandro writing a program for drawing punk rock songs given the sequence of
notes?

Input

The input contains several test cases. Each test case is described in a single line that contains
the number of notes N (1 ≤ N ≤ 100), followed by the sequence of N notes. Each note is one
of A, A#, B, C, C#, D, D#, E, F, F#, G and G#. Values in each line are separated by single
spaces. The last line of the input contains a single −1 and should not be processed as a test
case.

Output

For each test case output the music score of the input song and print a blank line after each test
case (even after the last one). You have to follow the sample input and output for drawing the
music scores. Every score line has the same background formed by the characters “|” (pipe)
and “-” (hyphen). They differ in the borders (first and last borders are doubled), and of course
in the notes they have inside. Each eighth note is drawn consecutively as in the sample, and
the different heights are those shown. Alterations are preceded by a character “#” (sharp sign).
There must be no trailing spaces at the end of printed lines, neither empty score lines (without
notes inside).

Example

Input:

36 E F F# G G# A A# B C C# D D# E F F# G G# A A# B C C# D D# E F F# G G# A A# B C C# D D#
-1

Output:
||                        |                        |                        |                        |
||------------------------|------------------------|--------------|\----|\--|------------------------|
||                        |                        |  |\    |\    |     |   |                        |
||------------------------|--------------------|\--|--|-----|----x|---#x|---|------------------------|
||                        |        |\    |\    |   | x|   #x|               |                        |
||--------------------|\--|--|\----|-----|----x|---|------------------------|--------------------|\--|
||        |\    |\    |   |  |    x|   #x|         |                        |        |\    |\    |   |
||--|\----|-----|----x|---|#x|---------------------|------------------------|--|\----|-----|----x|---|
||  |    x|   #x|         |                        |                        |  |    x|   #x|         |
||-x|---------------------|------------------------|------------------------|-x|---------------------|
||                        |                        |                        |                        |
 |                        |                        |                        |                        |
 |------------------------|--------------|\----|\--|------------------------|------------------------|
 |                        |  |\    |\    |     |   |                        |                        |
 |--------------------|\--|--|-----|----x|---#x|---|------------------------|--------------------|\--|
 |        |\    |\    |   | x|   #x|               |                        |        |\    |\    |   |
 |--|\----|-----|----x|---|------------------------|--------------------|\--|--|\----|-----|----x|---|
 |  |    x|   #x|         |                        |        |\    |\    |   |  |    x|   #x|         |
 |#x|---------------------|------------------------|--|\----|-----|----x|---|#x|---------------------|
 |                        |                        |  |    x|   #x|         |                        |
 |------------------------|------------------------|-x|---------------------|------------------------|
 |                        |                        |                        |                        |
 |                        |                        |                        |                        ||
 |--------------|\----|\--|------------------------|------------------------|------------------------||
 |  |\    |\    |     |   |                        |                        |                        ||
 |--|-----|----x|---#x|---|------------------------|------------------------|------------------------||
 | x|   #x|               |                        |                        |                        ||
 |------------------------|------------------------|------------------------|------------------------||
 |                        |                        |                        |                        ||
 |------------------------|------------------------|------------------------|------------------------||
 |                        |                        |                        |                        ||
 |------------------------|------------------------|------------------------|------------------------||
 |                        |                        |                        |                        ||

hide comments
sonudoo: 2017-01-29 11:51:09

Tricky :). Python 0.03s AC

Ehor Nechiporenko: 2013-01-30 09:12:10

Strange, that so many people has ignored such simple task.


Added by:Pablo Ariel Heiber
Date:2010-08-13
Time limit:0.375s
Source limit:50000B
Memory limit:1536MB
Cluster: Cube (Intel G860)
Languages:All except: PERL6
Resource:FCEyN UBA ICPC Selection 2007