In what concerns the continuous evaluation solving exercises grade during the semester, you should submit until 23:59 of October 18th
(this exercise will still be available for submission after that deadline, but without couting towards your grade)
[to understand the context of this problem, you should read the class #02 exercise sheet]
Numbers have personalities too! Some like to climb up in ascending order, while others prefer to slide down in a nice, orderly descent. There are also those that form a perfect mountain shape, increasing until reaching a peak and then decreasing. But some other numbers? Well, they just can't make up their mind and zigzag all over the place! Your task today is to determine if a number has its act together or if it's simply a chaotic mess.
Write a program that takes a positive integer number num and computes the shape of its digits:
The input consists of a single integer number n.
The output should be a single line determining the order of the digits in the input number. The program should print increasing
, decreasing
, mountain
or chaotic
according to the type of number as described before.
The following limits are guaranteed in all the test cases that will be given to your program:
10 ≤ num ≤ 1020 | Input number |
Example Input 1 | Example Output 1 |
1356 |
increasing |
Example Input 2 | Example Output 2 |
985 |
decreasing |
Example Input 3 | Example Output 3 |
157842 |
mountain |
Example Input 4 | Example Output 4 |
123212 |
chaotic |