 Check if the number is balanced
##### Submissions: 2453   Accuracy: 41.75%   Difficulty: Basic   Marks: 1

Given an odd-digit-number N, you need to find whether the given number is a balanced-number or not. An odd digit number is called a balanced number if the sum of all digits to the left of the middle digit and the sum of all digits to the right of the middle digit is equal.

Input:
The first line of the input contains a single integer T, denoting the number of test cases. Then T test case follows, a single line of the input containing a positive integer N.

Output:
For each test-case, print 0 if the number is not balanced, and 1 if the number is balanced.

Constraints:
1 <= T <= 100
1 <= N <= 1020

Example:
Input:
5
121
1234006
19091
12345
90988

Output:
1
1
1
0
0

Explanation:
For testcase 1: 121.

The number of digits of 121 is 3, i.e. odd digits. The middle digit is 2. LHS sum is 1, and RHS sum is 1.
Since the sums are equal, we output 1.

For testcase 2: 1234006.

The number of digits of 1234006. is 7, i.e. odd digits. The middle digit is 4. LHS sum is 1+2+3=6, and RHS sum is 0+0+6=6.
Since the sums are equal, we output 1.

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

Contributor: Ankit Sharma
Author: Soul_xhacker

If you have purchased any course from GeeksforGeeks then please ask your doubt on course discussion forum. You will get quick replies from GFG Moderators there.