407154: GYM102697 125 Chord Identification

Memory Limit:256 MB Time Limit:1 S
Judge Style:Text Compare Creator:
Submit:0 Solved:0

Description

125. Chord Identificationtime limit per test1 secondmemory limit per test256 megabytesinputstandard inputoutputstandard output
This problem is worth 35 points.

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.

Input

The 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.

Output

Output a single note: the root of the chord.

ExamplesInput
E G C
Output
C
Input
Bf Ef G
Output
Ef
Input
C F A
Output
F
Input
C# F Af
Output
C#

加入题单

算法标签: