407154: GYM102697 125 Chord Identification
Description
You're listening to music, and you hear a major chord of three notes. You want to figure out which chord you just heard.
In music, the notes in a single octave, from lowest to highest, are as follows: C, C#, D, D#, E, F, F#, G, G#, A, A#, and B. Any two adjacent notes in this list are a "half step" apart. For example, C and D differ by 2 half steps, and A and D differ by 5 half steps.
Additionally, notes can be represented as both sharps and flats. For example, C# and D ♭ (D flat) are the same note, and D# and E ♭ are the same note. A flat note will be represented with a lowercase f in the input, such as "Df" for D flat.
A major chord has a $$$root$$$, a $$$third$$$ note, and a $$$fifth$$$ note. The root and the third note must differ by exactly four half steps, and the third and fifth note must differ by exactly three half steps. Correspondingly, the root and the fifth note must differ by exactly seven half steps.
Given this information, and a major chord, figure out what the root of the chord is. The notes of the chord can be given in any order, i.e. the root doesn't necessarily come first.
InputThe only line of input contain three space-separated notes. It is guaranteed that the notes form a major chord with the root being one of the three notes.
OutputOutput a single note: the root of the chord.
ExamplesInputE G COutput
CInput
Bf Ef GOutput
EfInput
C F AOutput
FInput
C# F AfOutput
C#