(No problem statement.)
The input starts with an integer n specifying the number of test cases.
Each case consists of a positive integer N with at most 100 digits and a positive integer M at most 1000, both on a single line.
Our target is to remove digits from N in order to convert it into a number divisible by M.
We assume that if you remove all digits from N, it gives 0 and is divisible by M.
For each test case, print on a single line the minimum number of digits we need to remove from N, so that the resulting number is divisible by M.
3 360000000000000000000000000000 10 1234567891011121314151617181920 3 23010692543023 23
0 0 2