#include <bits/stdc++.h>
using namespace std;
int k, dp[5005][5005];
pair<int, int> res;
string s;
struct trie {
  trie *a, *b;
  int last, cnt;
  trie() {
    a = nullptr;
    b = nullptr;
    cnt = 0;
  }
};
void insert(trie *x, int ind) {
  x->last = ind;
  x->cnt++;
  if (ind < s.length()) {
    if (s[ind] == 'a') {
      if (x->a == nullptr) x->a = new trie();
      insert(x->a, ind + 1);
    } else {
      if (x->b == nullptr) x->b = new trie();
      insert(x->b, ind + 1);
    }
  }
}
bool get(trie *x, int lvl) {
  if (lvl && dp[x->last - lvl][x->last - 1]) {
    if (x->cnt >= k) {
      res = make_pair(x->last - lvl, x->last - 1);
      return true;
    } else
      k -= x->cnt;
  }
  if (x->a != nullptr) {
    if (get(x->a, lvl + 1)) return true;
  }
  if (x->b != nullptr) {
    if (get(x->b, lvl + 1)) return true;
  }
  return false;
}
int main() {
  ios::sync_with_stdio(false);
  cin.tie(0);
  cin >> s >> k;
  for (int i = 1; i <= s.length(); i++) {
    for (int j = 0; j + i <= s.length(); j++) {
      int l = i + j - 1;
      dp[j][l] = (s[j] == s[l] && (j + 2 >= l - 2 || dp[j + 2][l - 2]));
    }
  }
  trie *root = new trie();
  for (int i = 0; i < s.length(); i++) {
    insert(root, i);
  }
  get(root, 0);
  cout << s.substr(res.first, res.second - res.first + 1) << endl;
  return 0;
}
