Back
Close

Musical transposition device

Statement

 Goal

Music requires lots of transposition. Transposition is a process of "moving" a song up or down to better accomodate an ability of an instrument or singer.

For instance a child may need to sing "Happy Birthday" in a key of G, an old gentleman may need the same song in the key of D.

The process involves shifting notes up or down according to their names in a given order.

Note names are
C C# D Eb E F F# G Ab A Bb B

Your program will transpose notes up or down to the correct key.
Input
Line 1: instructions with the original and target key separated by spaces
Line 2: song to be transposed made of notes separated by spaces
Output
One line with transposed notes separated by spaces
Constraints
1≤ note name length ≤ 2
max 1024 notes in a song
Example
Input
C G
C D E F G
Output
G A B C D

Game modes
Fastest, Shortest

Test cases
Ukulele Test
Input
C G C D E F G
Output
G A B C D

Ukulele Validator
Input
F C C D E F G
Output
G A B C D

Easy Test
Input
A G G A
Output
F G

Easy Validator
Input
G F C D E F G
Output
Bb C D Eb F

Small detail Test
Input
C B B
Output
Bb

Small detail Validator
Input
F E E
Output
Eb

Small detail 2 Test
Input
C C# D Eb E
Output
Eb E F

Small detail 2 Validator
Input
Ab A D Eb E
Output
Eb E F

Be Original Test
Input
G G C D E F G
Output
C D E F G

Be Original Validator
Input
Bb Bb C D E F G
Output
C D E F G

Solution language

Solution

Stub generator input