#include <bits/stdc++.h>
using namespace std;
struct node {
  node *next[2];
  char c;
  int sum;
} * root, *last;
char str[5001];
bool dp[5001][5001];
int len, k, sum, lastkey;
string res;
void insert(int be, int en) {
  node *p = last, *q;
  int id;
  while (be <= en) {
    id = str[be++] - 'a';
    q = p->next[id];
    if (!q) {
      q = new node;
      q->next[0] = q->next[1] = 0;
      q->sum = 0;
      q->c = char('a' + id);
      p->next[id] = q;
    }
    p = q;
  }
  p->sum++;
  last = p;
}
void dfs(node *p) {
  if (!p) return;
  sum += p->sum;
  if (sum < k) dfs(p->next[0]);
  if (sum < k) dfs(p->next[1]);
  if (sum >= k) {
    if (p->c != '&') res += p->c;
  }
}
int main() {
  while (cin >> str) {
    len = strlen(str);
    cin >> k;
    memset(dp, 0, sizeof(dp));
    for (int i = 0; i < len; i++) {
      for (int j = 0; i + j < len; j++) {
        if (i > 3) {
          if (dp[j + 2][i + j - 2] && str[j] == str[i + j]) dp[j][i + j] = 1;
        } else if (str[j] == str[i + j])
          dp[j][i + j] = 1;
      }
    }
    root = new node;
    root->next[0] = root->next[1] = 0;
    root->sum = 0;
    root->c = '&';
    for (int i = 0; i < len; i++) {
      last = root;
      lastkey = i;
      for (int j = i; j < len; j++) {
        if (dp[i][j]) {
          insert(lastkey, j);
          lastkey = j + 1;
        }
      }
    }
    res = "";
    sum = 0;
    dfs(root);
    reverse(res.begin(), res.end());
    cout << res << endl;
  }
  return 0;
}
