#P7539. Determine the Order of the C Major Scale
Determine the Order of the C Major Scale
Determine the Order of the C Major Scale
The C major scale consists of 8 notes: c, d, e, f, g, a, b, C
. Each note is assigned a number from 1 to 8 respectively. The scale may appear in ascending order (from 1 to 8), descending order (from 8 to 1), or in a mixed order.
Given a sequence of the 8 numbers representing the order of notes, determine whether the scale is ascending, descending, or mixed.
Note: The ordering is strict. Only when the numbers are exactly 1 2 3 4 5 6 7 8 is the order ascending, and only when they are exactly 8 7 6 5 4 3 2 1 is it descending. All other orders are considered mixed.
inputFormat
The input consists of a single line containing 8 integers separated by spaces, representing the numbering of the notes in the scale.
For example: 1 2 3 4 5 6 7 8
outputFormat
Output a single word: ascending
if the sequence is in ascending order, descending
if it is in descending order, or mixed
otherwise.
sample
1 2 3 4 5 6 7 8
ascending