Problem A
Chord Detection
In music, a chord is a set of different notes played simultaneously. In this problem, your task is to determine what chord is played given a set of notes.
For simplicity, we name the 12 notes of the normal chromatic scale C, C#, D, D#, E, F, F#, G, G#, A, A# and B in increasing order of frequency. When played in music, these notes are cyclical. The next 12 notes are thus called the same, so that the notes after B is again called C, C# and so on, but played at double the frequency.
There are many different kinds of chords in music. The most basic of them is called a major chord. It consists of three notes: first a base note $x$, followed by the 4’th note after that, followed by the 3’rd note after that. This is called the $x$ major chord. For example, the C major chord consists of the notes C, E and G. Remember that the notes act cyclically. Therefore, A major consists of A, D (skipping A#, C, C#) and F (skipping D#, E).
It can be shown that three tones never form two different chords, even if one changes their order. Thus, one may say that the notes E, G and C also form the C major chord.
Given the names of three tones, determine if it they form a major chord, and if so, which one.
Input
The input consists of three lines, each containing the name of a note. All notes will have different names.
Output
If the three notes in the input constitute a major chord, output x major, where $x$ is the base note of the chord.
Otherwise, output not a chord.
Sample Input 1 | Sample Output 1 |
---|---|
C E G |
C major |
Sample Input 2 | Sample Output 2 |
---|---|
G C E |
C major |
Sample Input 3 | Sample Output 3 |
---|---|
A B C |
not a chord |
Sample Input 4 | Sample Output 4 |
---|---|
F A C |
F major |