Tidy Number
Submissions: 1909   Accuracy:

33.23%

  Difficulty: Basic   Marks: 1
     

Given a number, the task is to check if it is tidy or not. A tidy number is a number whose digits are in non-decreasing order.

Examples:

Input : 1234
Output : Yes

Input : 1243
Output : No
Digits "4" and "3" violate the property.


Input:
The first line of input contains an integer T denoting the no of test cases. For each test case there will be single line containing an integer N.

Output:
For each test case in a new line print 1 if the no is a tidy number else print 0.

Constraints:
1 <= T <= 100
1 <= N <= 10^9+7

Example:
Input:

2
1234
1243
Output:
1
0

** For More Input/Output Examples Use 'Expected Output' option **

Author: Shubham Joshi 1


Need help with your code? Please use ide.geeksforgeeks.org, generate link and share the link here.

to report an issue on this page.