SP7258 SUBLEX - Lexicographical Substring Search

Description

Little Daniel loves to play with strings! He always finds different ways to have fun with strings! Knowing that, his friend Kinan decided to test his skills so he gave him a string **S** and asked him **Q** questions of the form: If all distinct substrings of string **S** were sorted lexicographically, which one will be the **K-th** smallest? After knowing the huge number of questions Kinan will ask, Daniel figured out that he can't do this alone. Daniel, of course, knows your exceptional programming skills, so he asked you to write him a program which given **S** will answer Kinan's questions. **Example:** **S** = "aaa" (without quotes) substrings of S are "a" , "a" , "a" , "aa" , "aa" , "aaa". The sorted list of substrings will be: "a", "aa", "aaa". ### Input In the first line there is Kinan's string **S** (with length no more than 90000 characters). It contains only small letters of English alphabet. The second line contains a single integer **Q** (**Q**

Input Format

N/A

Output Format

N/A