Under construction

Still being built. Things may change

Alpsoo

Time limit1sMemory limit512 MB

Summary
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 XX, determine whether XX 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 00.

Input

The first line gives a positive integer XX.

Output

If XX is an Alpsoo, print ALPSOO; otherwise print NON ALPSOO.

Constraints

3≤3 ≤ the number of digits of XX ≤105≤ 10^5

Examples3

  1. Example 1

    Input
    135264
    
    Expected output
    ALPSOO
    
  2. Example 2

    Input
    14540
    
    Expected output
    NON ALPSOO
    
  3. Example 3

    Input
    3455517
    
    Expected output
    NON ALPSOO