#include <bits/stdc++.h>
using namespace std;
using ll = long long;
using vi = vector<int>;
using vvi = vector<vi>;
using pii = pair<int, int>;
constexpr auto MOD = 1000000007LL;
constexpr auto LINF = (1LL << 60);
constexpr auto INF = 2147483647LL;
constexpr auto PI = 3.1415926535897932384626433;
constexpr auto EPS = 1E-9;
template <typename T1, typename T2>
ostream& operator<<(ostream& out, const pair<T1, T2> p) {
  out << p.first << ' ' << p.second;
  return out;
}
template <typename T1, typename T2>
istream& operator>>(istream& in, pair<T1, T2>& p) {
  in >> p.first >> p.second;
  return in;
}
template <typename T>
istream& operator>>(istream& in, vector<T>& v) {
  for (auto& x : v) in >> x;
  return in;
}
template <typename T>
ostream& operator<<(ostream& out, vector<T> v) {
  for (int i = 0; i < v.size(); i++)
    out << v[i] << (i + 1 == v.size() ? '\n' : ' ');
  out.flush();
  return out;
}
string str;
int n, dp[5010][5010], sum[5010];
int k, st[5010];
int dpfs(int l, int r) {
  int len = r - l;
  if (len <= 0) return 1;
  int& res = dp[l][r];
  if (res != -1) return res;
  res = 0;
  if (len == 1) return res = 1;
  if (len == 2) return res = (str[l] == str[l + 1]);
  if (str[l] == str[r - 1]) {
    res = dpfs(l + 2, r - 2);
  }
  return res;
}
void init() {
  cin >> str;
  n = str.length();
  memset(dp, -1, sizeof(dp));
  for (int len = 1; len <= n; len++) {
    for (int st = 0; st + len <= n; st++) {
      dpfs(st, st + len);
    }
  }
  for (int i = 0; i < n; i++) {
    sum[i] = accumulate(dp[i] + i + 1, dp[i] + n + 1, 0);
  }
  fill(st, st + 5010, 1);
}
void build(int len) {
  int cnt = 0;
  for (int i = 0; i < n; i++) {
    if (st[i] == 0 || i + len > n)
      continue;
    else {
      char x = str[i + len - 1];
      if (x == 'a') {
        cnt += sum[i];
      }
    }
  }
  char x = (k <= cnt ? 'a' : 'b');
  cout << x;
  if (x == 'b') {
    k -= cnt;
  }
  for (int i = 0; i + len <= n; i++) {
    if (st[i] == 0) continue;
    if (str[i + len - 1] != x) {
      st[i] = 0;
    } else {
      if (dp[i][i + len] == 1) {
        k--;
        sum[i]--;
      }
    }
  }
  if (k > 0) {
    build(len + 1);
  }
}
int main() {
  ios_base::sync_with_stdio(false);
  init();
  cin >> k;
  build(1);
  return 0;
}
