In music theory, an interval is the difference between two pitches. Each pitch is defined by the number of half-steps (The difference between C and C#) or whole steps (The difference between C and D). One whole step is the same as two half-steps. Here is a list of all the default intervals and the number of half-steps they represent:
0 Perfect Unison 2 Major Second 4 Major Third 5 Perfect Fourth 7 Perfect Fifth 9 Major Sixth 11 Major Seventh 12 Perfect Octave
There are 3 variations on the default intervals, minor, diminished, and augmented.
A minor interval is one half-step lower than a major interval, but not a perfect interval. So you have a minor second (1), a minor third (3), a minor sixth (8), and a minor seventh (10). There is no such thing as a minor fourth, minor fifth, minor unison or minor octave since these are all perfect intervals.
A diminished interval is one half-step lower than a minor or perfect interval. There is diminished Second (0), diminished third (2), diminished fourth (4), diminished fifth (6), diminished sixth (7), diminished seventh (9) and diminished octave (11).
An augmented interval is one half-step higher than a major or perfect interval. We have Augmented Unison (1), Augmented Second (3), Augmented third (5), Augmented Fourth (6), Augmented fifth, (8), Augmented sixth (10), and Augmented seventh (12).
You must write a program or function that takes a number of half steps or whole steps and then prints one of the valid English descriptions of this interval. It doesn't matter which description you pick, as long as it exactly matches the IO table. You can take this as one string
"5w" == 5 whole steps "3h" == 3 half steps
or as a number and a string/char.
5, "w" == 5 whole steps 3, "h" == 3 half steps.
You can assume that every input will be between 0 and 12 half steps.
Here is a full list mapping the number of half-steps to all acceptable outputs.
0 Perfect unison, Diminished second 1 Minor second, Augmented unison 2 Major second, Diminished third 3 Minor third, Augmented second 4 Major third, Diminished fourth 5 Perfect fourth, Augmented third 6 Diminished fifth, Augmented fourth 7 Perfect fifth, Diminished sixth 8 Minor sixth, Augmented fifth 9 Major sixth, Diminished seventh 10 Minor seventh, Augmented sixth 11 Major seventh, Diminished octave 12 Perfect octave, Augmented seventh
Here is some sample I/O:
5w Minor Seventh 5h Augmented Third 12h Perfect Octave 12w UNDEFINED 1w Diminished third 2h Major Second