Matthew has purchased a new game and isn't feeling like completing his home work his teacher gave it to him. Can you help Matthew to complete his home work ?
The homework is :
Given an integer , find the minimum number of digits which needs to be removed from so that becomes a perfect square without leading zeros. If there is no possible solution print .
First line contains an integer , the number of test cases.
Following lines, contain an integer .
Print lines with answer for each .
3 6434 625 333
2 0 -1
Login to submit