#include <bits/stdc++.h>
char dp[5001][5001];
std::vector<std::vector<unsigned int> > tPos;
std::string str;
int K;
void solveDP();
void solve(std::string& OutStr);
int main() {
  str.reserve(50001);
  std::cin >> str >> K;
  ::memset(dp, 0, 5001 * 5001);
  solveDP();
  std::string out_str;
  out_str.reserve(str.size() + 1);
  solve(out_str);
  std::cout << out_str << std::endl;
  return 0;
}
void solveDP() {
  int N = str.size();
  dp[N - 1][0] = 3;
  for (int i = N - 2; i >= 0; --i) {
    dp[i][0] = 3;
    dp[i][1] = (str[i] == str[i + 1]) ? 3 : 1;
    for (int j = 2, n = N - i; j < n; ++j) {
      bool flag = (str[i] == str[i + j]);
      int val = dp[i + 1][j - 2];
      if (val) {
        if (val == 3)
          dp[i][j] = (flag) ? 3 : 1;
        else if (val == 2)
          dp[i][j] = 1;
        else if (val == 1)
          dp[i][j] = (flag) ? 2 : 0;
      }
    }
  }
  tPos.resize(N);
  for (int i = 0; i < N; ++i) tPos[i].reserve(5000);
  for (int i = N - 1; i >= 0; --i)
    for (int j = N - i - 1; j >= 0; --j)
      if (dp[i][j] > 1) tPos[i].push_back(i + j);
}
void solve(std::string& OutStr) {
  unsigned int N = str.size();
  for (int m = 0; K > 0; ++m) {
    int aCnt = 0, bCnt = 0;
    for (unsigned int i = 0; i < N; ++i) {
      if (tPos[i].size()) {
        if (str[i + m] == 'a')
          aCnt += tPos[i].size();
        else
          bCnt += tPos[i].size();
      }
    }
    char ch = (K <= aCnt) ? 'a' : 'b';
    if (ch == 'b') K -= aCnt;
    for (unsigned int i = 0; i < N; ++i) {
      if (tPos[i].size()) {
        if (str[i + m] != ch)
          tPos[i].clear();
        else {
          int k = tPos[i].back();
          if (!(k - m - i)) tPos[i].pop_back(), K--;
        }
      }
    }
    OutStr.push_back(ch);
  }
}
