#include <bits/stdc++.h>
const int N = 5005;
using namespace std;
pair<int, int> sub[N * N / 2];
char s[N];
int n, nSub;
namespace optimal {
int sa[N], tmp[N], pos[N];
int lcp[N], minLCP[N][N];
int gap;
bool sufCmp(int a, int b) {
  if (pos[a] != pos[b]) return pos[a] < pos[b];
  a += gap;
  b += gap;
  return (a < n && b < n) ? pos[a] < pos[b] : a > b;
}
void buildSA() {
  for (int i = 0; i < n; ++i) sa[i] = i, pos[i] = s[i];
  for (gap = 1;; gap <<= 1) {
    sort(sa, sa + n, sufCmp);
    for (int i = 0; i + 1 < n; ++i)
      tmp[i + 1] = tmp[i] + sufCmp(sa[i], sa[i + 1]);
    for (int i = 0; i < n; ++i) pos[sa[i]] = tmp[i];
    if (tmp[n - 1] == n - 1) break;
  }
}
void kasaiLCP() {
  for (int i = 0, k = 0; i < n; ++i)
    if (pos[i] + 1 < n) {
      for (int j = sa[pos[i] + 1]; s[j + k] == s[i + k];) ++k;
      lcp[pos[i]] = k;
      if (k > 0) --k;
    }
  for (int i = 0; i < n; ++i) {
    minLCP[i][i] = n - sa[i];
    for (int j = i + 1; j < n; ++j)
      minLCP[i][j] = min(minLCP[i][j - 1], lcp[j - 1]);
  }
}
inline bool subCmp(pair<int, int> a, pair<int, int> b) {
  if (a.first == b.first) return a.second < b.second;
  bool rev = 0;
  if (pos[a.first] > pos[b.first]) {
    swap(a, b);
    rev = 1;
  }
  assert(pos[a.first] < pos[b.first]);
  if (minLCP[pos[a.first]][pos[b.first]] >=
      min(a.second - a.first + 1, b.second - b.first + 1))
    return (make_pair(a.second - a.first, a) <
            make_pair(b.second - b.first, b)) ^
           rev;
  return 1 ^ rev;
}
void show() {
  for (int i = 0; i < nSub; ++i) {
    for (int j = sub[i].first; j <= sub[i].second; ++j) cout << s[j];
    cout << endl;
  }
}
inline pair<int, int> quickSelect(int l, int r, int kth) {
  assert(l <= r);
  if (l == r) {
    assert(kth == 1);
    return sub[l];
  }
  pair<int, int> pivot = sub[rand() % (r - l + 1) + l];
  int i = l, j = r;
  do {
    while (subCmp(sub[i], pivot)) ++i;
    while (subCmp(pivot, sub[j])) --j;
    if (i <= j) {
      if (i != j) swap(sub[i], sub[j]);
      ++i;
      --j;
    }
  } while (i <= j);
  int pos = l + kth - 1;
  if (j < pos && pos < i) return pivot;
  if (pos <= j) return quickSelect(l, j, kth);
  assert(i <= pos);
  return quickSelect(i, r, kth - (i - l));
}
void main(int kth) {
  buildSA();
  kasaiLCP();
  pair<int, int> ans = quickSelect(0, nSub - 1, kth);
  for (int i = ans.first; i <= ans.second; ++i) cout << s[i];
}
};  // namespace optimal
int kth;
int main() {
  ios::sync_with_stdio(0);
  cin.tie(0);
  cin >> s >> kth;
  n = strlen(s);
  for (int i = 0; i < n; ++i) {
    for (int l = i, r = i + 3; 0 <= l && r < n && s[l] == s[r]; l -= 2, r += 2)
      sub[nSub++] = {l, r};
    for (int l = i, r = i + 2; 0 <= l && r < n && s[l] == s[r]; l -= 2, r += 2)
      sub[nSub++] = {l, r};
    for (int l = i, r = i + 1; 0 <= l && r < n && s[l] == s[r]; l -= 2, r += 2)
      sub[nSub++] = {l, r};
    for (int l = i, r = i + 0; 0 <= l && r < n && s[l] == s[r]; l -= 2, r += 2)
      sub[nSub++] = {l, r};
  }
  optimal::main(kth);
  return 0;
}
