#include <bits/stdc++.h>
using namespace std;
const int N = 5000 + 5;
const int BASE = 2333;
unsigned long long fac[N], f[2][N];
char s[N];
pair<int, int> pos[N];
unsigned long long get_hash(int id, int l, int r) {
  if (l - 2 < 0) return f[id][r];
  return f[id][r] - f[id][l - 2] * fac[(r - l) / 2 + 1];
}
int K, sum[33];
vector<int> vt[N];
string solve() {
  int n = strlen(s + 1);
  f[0][0] = 0;
  f[0][1] = s[1] - 'a' + 1;
  for (int i = 2; i <= n; i++) {
    f[0][i] = f[0][i - 2] * BASE + s[i] - 'a' + 1;
  }
  f[1][0] = 0;
  f[1][1] = s[n] - 'a' + 1;
  for (int i = 2; i <= n; i++) {
    f[1][i] = f[1][i - 2] * BASE + s[n - i + 1] - 'a' + 1;
  }
  for (int i = 1; i <= n; i++) {
    vt[i].clear();
    for (int j = i; j <= n; j++) {
      int len = j - i + 1;
      int tmp = ((len + 1) / 2 + 1) / 2;
      if (get_hash(0, i, i + (tmp + 1) * 2 - 1 - 3) ==
          get_hash(1, n - j + 1, n - (j - (tmp + 1) * 2 + 1 + 3) + 1)) {
        vt[i].push_back(j);
      }
    }
    reverse(vt[i].begin(), vt[i].end());
  }
  string ans = "";
  for (int i = 1; i <= n; i++) {
    int cnt = 0;
    for (int j = 1; j <= n; j++)
      if (vt[j].size() && vt[j][vt[j].size() - 1] - j + 1 < i) {
        cnt++;
        vt[j].pop_back();
      }
    K -= cnt;
    if (K <= 0) break;
    int sum[2];
    sum[0] = sum[1] = 0;
    for (int j = 1; j <= n; j++)
      if (vt[j].size()) sum[s[j + i - 1] - 'a'] += vt[j].size();
    if (sum[0] < K) {
      for (int j = 1; j <= n; j++)
        if (vt[j].size()) {
          if (s[j + i - 1] == 'a') vt[j].clear();
        }
      K -= sum[0];
      ans += 'b';
    } else {
      for (int j = 1; j <= n; j++)
        if (vt[j].size()) {
          if (s[j + i - 1] == 'b') vt[j].clear();
        }
      ans += 'a';
    }
  }
  return ans;
}
void init(int n) {
  fac[0] = 1;
  for (int i = 1; i <= n; i++) fac[i] = fac[i - 1] * BASE;
}
int main() {
  init(5000);
  scanf("%s%d", s + 1, &K);
  cout << solve() << endl;
  return 0;
}
