#include <bits/stdc++.h>
using namespace std;
long long gcd(long long a, long long b) { return b == 0 ? a : gcd(b, a % b); }
const int MAXLEN = 5000;
char s[MAXLEN + 1];
int n;
int want;
int len[4][MAXLEN];
int can[MAXLEN][MAXLEN], ncan[MAXLEN], at[MAXLEN];
bool match(int a, int b) {
  return 0 <= a && a < n && 0 <= b && b < n && s[a] == s[b];
}
void sol(int a, int b) { can[a][ncan[a]++] = b; }
void run() {
  scanf("%s%d", s, &want);
  n = strlen(s);
  --want;
  for (int j = (0); j < (n); ++j) ncan[j] = at[j] = 0;
  for (int i = (0); i < (4); ++i) {
    int dboth = i == 0 || i == 3 ? 1 : 0, dright = i % 2 == 0 ? 1 : 0;
    for (int j = (0); j < (n); ++j) {
      len[i][j] = 0;
      while (match(j - 2 * len[i][j] - dboth,
                   j + 2 * len[i][j] + dright + dboth)) {
        sol(j - 2 * len[i][j] - dboth, j + 2 * len[i][j] + dright + dboth);
        ++len[i][j];
      }
    }
  }
  for (int j = (0); j < (n); ++j) sort(can[j], can[j] + ncan[j]);
  for (int pos = 0;; ++pos) {
    int na = 0, nb = 0, nc = 0;
    for (int j = (0); j < (n); ++j) {
      while (at[j] < ncan[j] && j + pos > can[j][at[j]]) ++nc, ++at[j];
      if (at[j] < ncan[j]) (s[j + pos] == 'a' ? na : nb) += ncan[j] - at[j];
    }
    if (want < nc) {
      puts("");
      break;
    }
    want -= nc;
    if (want < na) {
      printf("a");
      for (int j = (0); j < (n); ++j)
        if (at[j] < ncan[j] && s[j + pos] != 'a') at[j] = ncan[j];
      continue;
    }
    want -= na;
    if (want < nb) {
      printf("b");
      for (int j = (0); j < (n); ++j)
        if (at[j] < ncan[j] && s[j + pos] != 'b') at[j] = ncan[j];
      continue;
    }
    want -= nb;
    printf("err\n");
    break;
  }
}
int main() {
  run();
  return 0;
}
