#include <bits/stdc++.h>
using namespace std;
const int N = 5005;
const int mod = 1000000007;
const int inf = (int)1e9;
int k, n, SA[N];
string s;
int dp[N][N];
bool rec(int a, int b) {
  if (a >= b) {
    return true;
  }
  if (dp[a][b] != -1) {
    return dp[a][b];
  }
  return dp[a][b] = s[a] == s[b] && rec(a + 2, b - 2);
}
bool cmp(int a, int b) { return s.substr(a) < s.substr(b); }
string answer;
struct node {
  int x, y, z;
  node() {}
  node(int _x, int _y, int _z) {
    x = _x;
    y = _y;
    z = _z;
  }
  bool operator<(const node other) const { return x > other.x; }
};
void solve() {
  priority_queue<node> pila;
  pila.push(node(0, n - 1, 0));
  while (!pila.empty()) {
    node where = pila.top();
    pila.pop();
    int x = where.x, y = where.y;
    int prof = where.z;
    if (prof) {
      for (int i = x; i <= y; ++i) {
        if (!rec(SA[i], SA[i] + prof - 1)) {
          continue;
        }
        k--;
        if (k == 0) {
          answer = s.substr(SA[i], prof);
        }
      }
    }
    int last = x;
    if (s[SA[x] + prof] == '$') {
      last = -1;
    }
    for (int i = x + 1; i <= y + 1; ++i) {
      if (i == y + 1 || s[SA[i] + prof] != s[SA[i - 1] + prof] ||
          s[SA[i] + prof] == '$') {
        if (last >= 0) {
          pila.push(node(last, i - 1, prof + 1));
        }
        last = i;
        if (s[SA[i] + prof] == '$') {
          last = -1;
        }
      }
    }
  }
}
const int MAXN = 5005;
int cnt[MAXN], c[MAXN];
int pn[MAXN], cn[MAXN];
void build_suffix_array() {
  memset(cnt, 0, 256 * sizeof(int));
  for (int i = 0; i < n; ++i) ++cnt[(int)s[i]];
  for (int i = 1; i < 256; ++i) cnt[i] += cnt[i - 1];
  for (int i = 0; i < n; ++i) SA[--cnt[(int)s[i]]] = i;
  c[SA[0]] = 0;
  int classes = 1;
  for (int i = 1; i < n; ++i) {
    if (s[SA[i]] != s[SA[i - 1]]) ++classes;
    c[SA[i]] = classes - 1;
  }
  for (int h = 0; (1 << h) < n; ++h) {
    for (int i = 0; i < n; ++i)
      pn[i] = (((SA[i] - (1 << h) + n) < (n)) ? (SA[i] - (1 << h) + n)
                                              : (SA[i] - (1 << h) + n) - (n));
    memset(cnt, 0, classes * sizeof(int));
    for (int i = 0; i < n; ++i) ++cnt[c[pn[i]]];
    for (int i = 1; i < classes; ++i) cnt[i] += cnt[i - 1];
    for (int i = n - 1; i >= 0; i--) SA[--cnt[c[pn[i]]]] = pn[i];
    for (int i = 0; i < n; ++i)
      pn[i] = (((SA[i] + (1 << h)) < (n)) ? (SA[i] + (1 << h))
                                          : (SA[i] + (1 << h)) - (n));
    cn[SA[0]] = 0;
    classes = 1;
    for (int i = 1; i < n; ++i) {
      if (c[SA[i]] != c[SA[i - 1]] || c[pn[i]] != c[pn[i - 1]]) ++classes;
      cn[SA[i]] = classes - 1;
    }
    memcpy(c, cn, n * sizeof(int));
  }
}
int main() {
  cin >> s >> k;
  s.push_back('$');
  n = s.size();
  build_suffix_array();
  memset(dp, -1, sizeof dp);
  solve();
  cout << answer << endl;
  return 0;
}
