Codeforces Beta Round 94 (Div. 1 Only)
B
String
Codeforces
2100
原题
← AC →
翻译中…

One day in the IT lesson Anna and Maria learned about the lexicographic order.

翻译中…

String $*x*$ is lexicographically less than string $*y*$, if either $*x*$ is a prefix of $*y*$ (and $*x* ≠ *y*$), or there exists such $*i*$ ($1 ≤ *i* ≤ *min*(|*x*|, |*y*|)$), that $*x*_{*i*} < *y*_{*i*}$, and for any $*j*$ ($1 ≤ *j* < *i*$) $*x*_{*j*} = *y*_{*j*}$. Here $|*a*|$ denotes the length of the string $*a*$. The lexicographic comparison of strings is implemented by operator < in modern programming languages​​.

翻译中…

The teacher gave Anna and Maria homework. She gave them a string of length $*n*$. They should write out all substrings of the given string, including the whole initial string, and the equal substrings (for example, one should write out the following substrings from the string "aab": "a", "a", "aa", "ab", "aab", "b"). The resulting strings should be sorted in the lexicographical order. The cunning teacher doesn't want to check all these strings. That's why she said to find only the $*k*$-th string from the list. Help Anna and Maria do the homework.

翻译中…

Input

翻译中…

The first line contains a non-empty string that only consists of small Latin letters ("a"-"z"), whose length does not exceed $10^{5}$. The second line contains the only integer $*k*$ ($1 ≤ *k* ≤ 10^{5}$).

翻译中…

Output

翻译中…

Print the string Anna and Maria need — the $*k*$-th (in the lexicographical order) substring of the given string. If the total number of substrings is less than $*k*$, print a string saying "No such line." (without the quotes).

翻译中…

Note

翻译中…

In the second sample before string "bc" follow strings "a", "ab", "abc", "b".

翻译中…

样例

Input #1
aa
2
Output #1
a
InputCopy OutputCopy
Input #2
abc
5
Output #2
bc
InputCopy OutputCopy
Input #3
abab
7
Output #3
b
InputCopy OutputCopy
题目信息
题号
128B
时间限制
2 s
内存限制
256 MB
标签
暴力
构造
哈希
模拟
后缀结构
字符串

题面与样例版权归 Codeforces 及出题人所有;中文翻译由 AI 生成(CI 管线),如有出入请以原文为准。