Consecutively Descending Integers

Medium

Given a string containing digits, determine if the string can be broken into consecutively descending integers.

Examples
String: "10099989796"
Answer: true
Explanation: [100, 99, 98, 97, 96]
String: "543210"
Answer: true
Explanation: [5, 4, 3, 2, 1, 0]
String: "54320"
Answer: false
Explanation: No way to create consecutive descending integers

Testing

Input Format

The first line contains an integer ‘T’ denoting the number of test cases.

For each test case, the input has one line with the string ‘s’.

Output Format

For each test case, the output contains true/false.

Sample Input

3
10099989796
543210
54320

Expected Output

true
true
false

Constraints

1 <= T <= 10

1 <= length of s <= 12

Each character of s is a digit.

Editorial Link: Editorial