CF128B.String

普及/提高-

通过率:0%

AC君温馨提醒

该题目为【codeforces】题库的题目,您提交的代码将被提交至codeforces进行远程评测,并由ACGO抓取测评结果后进行展示。由于远程测评的测评机由其他平台提供,我们无法保证该服务的稳定性,若提交后无反应,请等待一段时间后再进行重试。

题目描述

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

String xx is lexicographically less than string yy , if either xx is a prefix of yy (and xyx≠y ), or there exists such ii ( 1<=i<=min(x,y)1<=i<=min(|x|,|y|) ), that x_{i}<y_{i} , and for any jj ( 1<=j<i ) xj=yjx_{j}=y_{j} . Here a|a| denotes the length of the string aa . 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 nn . 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 kk -th string from the list. Help Anna and Maria do the homework.

输入格式

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

输出格式

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

输入输出样例

  • 输入#1

    aa
    2
    

    输出#1

    a
    
  • 输入#2

    abc
    5
    

    输出#2

    bc
    
  • 输入#3

    abab
    7
    

    输出#3

    b
    

说明/提示

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

首页