#CCBOTPBA0000032. Chuỗi tăng theo chữ số (Strictly Increasing Digits)
Chuỗi tăng theo chữ số (Strictly Increasing Digits)
Strictly Increasing Digits
Source: Phước Hưng OJ
Version: Phuoc Hung OJ Extended
Problem Statement
Check whether every successive decimal digit is strictly larger than its predecessor, read left to right; one-digit values qualify.
Input
One integer n.
Output
Print YES or NO.
Subtasks
-
Subtask 1 (20%):
n ≤ 999. -
Subtask 2 (30%):
n ≤ 10^9. -
Subtask 3 (50%):
n ≤ 10^18.
Examples
Example 1
Input:
12359
Output:
YES
Explanation: The digits satisfy 1<2<3<5<9.
Example 2
Input:
112
Output:
NO
Explanation: The adjacent ones are equal, violating strict increase.
Example 3
Input:
0
Output:
YES
Explanation: Zero contains only one digit.