Forgot Password ?
New password will be sent to following email id
Chotu and the Stolen Pokedex
Problem Code : POKEDEX
Time Limit :
C , C++ , Java , Python 2
Login to submit your response.
Our friend Chotu is on a journey to become a Pokémon master. One day, he came across a mysterious Pokémon, but before capturing the Pokémon he wants to know the category to which the Pokémon belongs.<br><br> His mentor, Professor Oak has given him a Pokédex to help him out in his journey. Those who are unknown to the Pokémon world, Pokédex is an instrument used to identify the category of a Pokémon. Unfortunately, Chotu's Pokédex has been stolen by the notorious Team Rocket. <br><br> Helpless, Chotu asks you to tell the category of the mysterious Pokémon. It is known that each Pokémon can be represented via a <b>numeric string S</b> .<br><br> <b>Note</b> - Numeric string is a string that comprise only of digits(0-9), ex- "123", "54532" is a numeric string whereas "123s" is not. <br><br> The type of the Pokémon is the largest prime <b>less the 10<sup>5</sup></b> that <b>perfectly divides</b> the string.<br> <b>Note</b> - For each Pokémon there will exist a prime which perfectly divides the string.
First line consists of single integer <b>T</b> denoting number of test cases.<br> Next T lines consists of a numeric string <b>S.</b>
The Pokémon category.
1 ≤ <b>T</b> ≤ 15<br> 1 ≤ <b>|S|</b> ≤ 1000
In the sample test case 17 is the largest prime that perfectly divides 51.