Under construction

Still being built. Things may change

Alice and Bob (and string): Double Menace

Time limit2sMemory limit512 MB

Summary
Given string s and k, find the k-th lexicographically smallest substring t of s from which Alice wins the two-sided extension game, or report that fewer than k exist.
Level

Hard9 of 10

Topics
Game theory, String matching, String
Solved
No attempts yet

Problem

Alice and Bob are playing a game. At the start they have a string ss and a substring tt of ss. On each turn, a player adds an arbitrary lowercase letter clc_l to the left of tt and an arbitrary lowercase letter crc_r to the right of tt, so that tt is still a substring of ss. A player who cannot make a valid move loses. Alice moves first.

Before her first move, Alice chooses the initial string tt. She wants a choice that guarantees her victory, assuming both players play optimally. To keep Bob from suspecting anything, she picks the kk-th lexicographically smallest of all winning initial strings. Help Alice.

Input

The first line contains the string ss of lowercase English letters (1≤∣s∣≤1051 \leq |s| \leq 10^5).

The second line contains the integer kk (1≤k≤10101 \leq k \leq 10^{10}).

Output

If there are fewer than kk winning initial strings, print "no solution". Otherwise, print the kk-th lexicographically smallest winning initial string. If that string is empty, print "-".

Hint

For s=abacs=\mathtt{abac}, the winning strings are -, a, b, and ba.

Examples3

  1. Example 1

    Input
    abac
    3
    
    Expected output
    b
    
  2. Example 2

    Input
    rndstr
    1
    
    Expected output
    -
    
  3. Example 3

    Input
    abc
    10
    
    Expected output
    no solution