Problems > Valid Integer

Valid Integer

Difficulty: 1000 2000 ms 128 MB

implementation strings

Is S a canonical integer literal: an optional sign, then digits with no leading zero (0 itself is fine)?

Input: one line with the candidate string S.

Output: YES or NO.

Constraints:

  • 1 ≤ |S| ≤ 100

Sample Tests

Input 1
-102
Output 1
YES
Input 2
0102
Output 2
NO

Read the Editorial

Discussion (opens after you solve — no spoilers before)

No comments yet.

Submit Your Solution

Log in or create a free account to run and submit code.