Write a program which accepts as input a positive integer and checks, using the algorithm described below, to see whether or not the integer is divisible by 11. This particular test for divisibility by 11 was given in 1897 by Charles L. Dodgson (Lewis Carroll).

- Algorithm:
- As long as the number being tested has more than two digits, form a new number by:
- deleting the units digit
- subtracting the deleted digit from the shortened number

Note: - Leading zeroes are not considered part of the number and should not be printed.

As usual, the first number in the input indicates the number of positive integers that follow. Each positive integer has a maximum of 50 digits. You may assume no leading zeroes exist in the positive integers.

For each positive integer in the input, the output consists of a series of numbers formed as a digit is deleted and subtracted, followed by a message indicating whether or not the original number is divisible by 11. Outputs for different positive integers are separated by blank lines.

#### Sample Input

```
1
12345678901234567900
```

#### Sample Output

```
12345678901234567900
1234567890123456790
123456789012345679
12345678901234558
1234567890123447
123456789012337
12345678901226
1234567890116
123456789005
12345678895
1234567884
123456784
12345674
1234563
123453
12342
1232
121
11
The number 12345678901234567900 is divisible by 11.
```

## Comments

Someone please check my code, I don't know what's wrong.... I kept on getting WAs. even though everything is right in the clipped output. Update: Never mind I found the mistake :)

Still cannot figure out what is the problem with my code -.- Can someone give me some hints as to what exactly I am doing wrong.

you have to print the number again, so if the number was 121, you have to print

not

which is what you are doing.

My mistake, I really should read questions carefully. Thank you very much!

maybe double for java

This is a bit (a lot) harder because the input number is so long you can't put it all in one big

`int`

or`long`

; the code will throw an`InputMismatchException`

The memory limit is also super low

Never mind this because the problem was edited some 22 years ago

Someone please add a multiple input output format

DAMNI forgot "."

......

i have to say i have some concerns about your requirements and because of that it has caused me to fail many times. you should explain just a bit more and it would be a lot clearer.

Each positive integer has a maximum of 50 digitsthis question doesnt allow us to use bigdecimal or biginteger. how else are we supposed to hold such a big number? or can you allow to use bigdecimal or biginteger?

String, byte array, int array, char array, etc

You

couldalways look into how`BigInteger`

works internally. Besides, allowing`BigInteger`

would be unfair to languages that don't have it, and would also defeat the purpose of the question.thanks alot :)

Just wondering, why is there no Python 3 in the allowed languages?

Allowing Python would make the problem trivial because of Python's support of arbitrarily big numbers.

Oh, right.

uh, java.lang.NumberFormatException?

(much larger than what can fit in even a long)

0-50+ digits works on my computer? w/o errors?

My bad, I assumed that would be your issue without reading your code. Try a number like

`848098180322800092606233221468227354577849547220`

.Hm, all the big numbers work in my code but I keep getting that NumberFormatError, any tips?

Try numbers:

54862354760000000000532645 10000000000500000000007

I did it bois. Thank you!

New testcases were added, and all submissions have been rejudged.

What's the exact text to output if the number is not divisible by 11? "The number ____ is not divisible by 11."?

Yes.