Alpsoo
Time limit1sMemory limit512 MB
Given a positive integer, decide whether its digit sequence rises then falls, with no flat step, and each slope kept constant within its part.
- Level
Easy3 of 10
- Topics
- Implementation, String, Simulation
- Solved
- No attempts yet
Problem
Take a positive integer and plot its digits in order at equal horizontal spacing as a line graph. If the resulting shape is a mountain whose uphill or downhill slope does not change partway, that positive integer is called an Alpsoo. A mountain shape starts uphill, ends downhill, and has no flat part. Given a positive integer , determine whether is an Alpsoo.
Uphill means a part of the graph with positive slope, downhill means a part with negative slope, and flat means a part with slope .
Input
The first line gives a positive integer .
Output
If is an Alpsoo, print ALPSOO; otherwise print NON ALPSOO.
Constraints
the number of digits of