#include <bits/stdc++.h>
const int dx[] = {1, 0, -1, 0};
const int dy[] = {0, 1, 0, -1};
using namespace std;
const int MAXN = 5050;
bool dp[MAXN][MAXN];
int sum[MAXN][MAXN];
string s;
int main() {
  cin.tie(0);
  ios::sync_with_stdio(false);
  cin >> s;
  int k;
  cin >> k;
  int n = s.size();
  for (int i = 0; i < n; i++) {
    dp[i][0] = dp[i][1] = true;
  }
  for (int L = 2; L <= n; L++) {
    for (int i = 0; i < n; i++) {
      if (i + L - 1 >= n) break;
      if (s[i] == s[i + L - 1]) {
        if (L <= 4)
          dp[i][L] = true;
        else
          dp[i][L] |= dp[i + 2][L - 4];
      }
    }
  }
  for (int i = 0; i < n; i++) {
    for (int j = n; j >= 0; j--) {
      sum[i][j] = sum[i][j + 1] + dp[i][j];
    }
  }
  string ans;
  vector<int> cand;
  for (int i = 0; i < n; i++) cand.push_back(i);
  for (int i = 1; i <= n; i++) {
    if (k == 0) break;
    int empty = 0, a = 0, b = 0;
    vector<int> A, B;
    for (int el : cand) {
      if (i > 1) {
        if (dp[el][i - 1]) empty++;
      }
      if (el + i - 1 < n) {
        if (s[el + i - 1] == 'a') {
          A.push_back(el);
          a += sum[el][i];
        } else {
          B.push_back(el);
          b += sum[el][i];
        }
      }
    }
    if (k <= empty)
      break;
    else if (k <= a + empty) {
      k -= empty;
      cand = A;
      ans += "a";
    } else {
      k -= empty + a;
      cand = B;
      ans += "b";
    }
  }
  cout << ans << endl;
  return 0;
}
