


You are given a number N. You need to find the remainder when N is divided by 11.
Note :Number N may be very large.
The first line contains an integer 'T' denoting the number of test cases to be run. The 'T' test cases follow.
The first line of each test case contains a single number 'N' in the form of a string.
Output Format :
For each test case, print an integer denoting the remainder when 'N' is divided by 11.
1 <= T <= 5
1 <= length of N <= 10 ^ 6
Time Limit: 1 sec
2
4475
345
9
4
For test case 1: When 4475 is divided by 11, the remainder comes out to be 9.
For test case 2: Similarly, when 345 is divided by 11, the remainder comes out to be 4.
2
55554444333
1331231
3
0
Store the number in the string and use modulo properties to calculate the remainder.
O(L) per test case, where ‘L’ is the number of digits in ‘N’.
In the worst case, we are traversing ‘N’ once, digit by digit.
O(1) per test case.
In the worst case, we are taking constant extra space.