#include <bits/stdc++.h>
using namespace std;
string str;
bool isHalfPal[5005][5005];
string builtStr;
int n;
class Trie {
 public:
  int child[2];
  int cnt;
  int total;
  Trie(int childCnt) {
    child[0] = child[1] = -1;
    total = cnt = 0;
  }
};
Trie* root;
vector<Trie*> suffixTrie;
void accumulate(Trie* node) {
  node->total = node->cnt;
  if (node->child[0] != -1) {
    accumulate(suffixTrie[node->child[0]]);
    node->total += suffixTrie[node->child[0]]->total;
  }
  if (node->child[1] != -1) {
    accumulate(suffixTrie[node->child[1]]);
    node->total += suffixTrie[node->child[1]]->total;
  }
}
void DFS(Trie* node, int k) {
  if (k <= node->cnt) {
    return;
  }
  k -= node->cnt;
  if (node->child[0] != -1) {
    if (suffixTrie[node->child[0]]->total >= k) {
      builtStr += 'a';
      DFS(suffixTrie[node->child[0]], k);
    } else {
      builtStr += 'b';
      DFS(suffixTrie[node->child[1]], k - suffixTrie[node->child[0]]->total);
    }
  } else {
    builtStr += 'b';
    DFS(suffixTrie[node->child[1]], k);
  }
}
int main() {
  cin >> str;
  int k;
  cin >> k;
  n = str.size();
  for (int i = 0; i < n; i++) {
    isHalfPal[i][i] = true;
  }
  for (int i = 0; i < n; i++) {
    for (int j = 0; j < i; j++) {
      isHalfPal[i][j] = true;
    }
  }
  for (int len = 1; len <= n; len++) {
    for (int i = 0; i + len - 1 < n; i++) {
      int j = i + len - 1;
      isHalfPal[i][j] = (str[i] == str[j] &&
                         (i + 2 >= n || j - 2 < 0 || isHalfPal[i + 2][j - 2]));
    }
  }
  root = new Trie(2);
  for (int i = 0; i < n; i++) {
    int j = i;
    Trie* temp = root;
    while (j < n) {
      if (str[j] == 'a') {
        if (temp->child[0] == -1) {
          temp->child[0] = suffixTrie.size();
          temp = new Trie(2);
          suffixTrie.push_back(temp);
        } else {
          temp = suffixTrie[temp->child[0]];
        }
        if (isHalfPal[i][j]) {
          temp->cnt++;
        }
      } else {
        if (temp->child[1] == -1) {
          temp->child[1] = suffixTrie.size();
          temp = new Trie(2);
          suffixTrie.push_back(temp);
        } else {
          temp = suffixTrie[temp->child[1]];
        }
        if (isHalfPal[i][j]) {
          temp->cnt++;
        }
      }
      j++;
    }
  }
  accumulate(root);
  DFS(root, k);
  cout << builtStr << endl;
  return 0;
}
