#include <bits/stdc++.h>
using namespace std;
const int M = 5010;
namespace SuffixArray {
const int MAXN = 1 << 21;
string S;
int N, gap;
int sa[MAXN], pos[MAXN], tmp[MAXN], lcp[MAXN];
bool sufCmp(int i, int j) {
  if (pos[i] != pos[j]) return pos[i] < pos[j];
  i += gap;
  j += gap;
  return (i < N && j < N) ? pos[i] < pos[j] : i > j;
}
void buildSA() {
  N = S.size();
  for (int i = 0; i < (int)(N); ++i) sa[i] = i, pos[i] = S[i];
  for (gap = 1;; gap *= 2) {
    sort(sa, sa + N, sufCmp);
    for (int i = 0; i < (int)(N - 1); ++i)
      tmp[i + 1] = tmp[i] + sufCmp(sa[i], sa[i + 1]);
    for (int i = 0; i < (int)(N); ++i) pos[sa[i]] = tmp[i];
    if (tmp[N - 1] == N - 1) break;
  }
}
void buildLCP() {
  for (int i = 0, k = 0; i < N; ++i)
    if (pos[i] != N - 1) {
      for (int j = sa[pos[i] + 1]; S[i + k] == S[j + k];) ++k;
      lcp[pos[i]] = k;
      if (k) --k;
    }
}
}  // namespace SuffixArray
using namespace SuffixArray;
bool dp[M][M];
void pre(string s, int n) {
  for (int i = 1; i <= n; i++) dp[i][i] = 1;
  for (int i = 1; i < n; i++) {
    if (s[i] == s[i + 1]) dp[i][i + 1] = 1;
    if (i == (n - 1)) continue;
    if (s[i] == s[i + 2]) dp[i][i + 2] = 1;
    if (i == (n - 2)) continue;
    if (s[i] == s[i + 3]) dp[i][i + 3] = 1;
  }
  for (int k = 5; k <= n; k++) {
    for (int i = 1; i + k - 1 <= n; i++) {
      int j = i + k - 1;
      if ((s[i] == s[j]) && dp[i + 2][j - 2]) dp[i][j] = 1;
    }
  }
}
int main() {
  string s;
  cin >> s;
  int n = s.size();
  s = "c" + s;
  pre(s, n);
  int k;
  cin >> k;
  S = s;
  buildSA();
  buildLCP();
  int match = 0;
  for (int i = 0; i < n; i++) {
    int j = sa[i];
    for (int l = match + 1; l + j - 1 <= n; l++) {
      int x = l + j - 1;
      if (!dp[j][x]) continue;
      int cnter = 1;
      for (int f = i; f < n - 1; f++) {
        if (lcp[f] < l) break;
        cnter++;
      }
      k -= cnter;
      if (k <= 0) {
        for (int f = j; f <= x; f++) cout << s[f];
        cout << endl;
        return 0;
      }
    }
    match = lcp[i];
  }
  assert(false);
}
