#include <bits/stdc++.h>
template <class T>
int size(const T &x) {
  return x.size();
}
using namespace std;
string s;
int dp[5003][5003];
int readint() {
  register char cc = getchar();
  while (cc < '0' || cc > '9') {
    cc = getchar();
  }
  int ans = 0;
  while (cc >= '0' && cc <= '9') {
    ans = ans * 10 + cc - '0';
    cc = getchar();
  }
  return ans;
};
struct SuffixArray {
  const int L;
  string s;
  vector<vector<int>> P;
  vector<pair<pair<int, int>, int>> M;
  SuffixArray(string s) : L(s.length()), s(s), P(1, vector<int>(L, 0)), M(L) {
    for (int i = 0; i < L; i++) P[0][i] = int(s[i]);
    for (int skip = 1, level = 1; skip < L; skip *= 2, level++) {
      P.push_back(vector<int>(L, 0));
      for (int i = 0; i < L; i++)
        M[i] =
            make_pair(make_pair(P[level - 1][i],
                                i + skip < L ? P[level - 1][i + skip] : -1000),
                      i);
      sort(M.begin(), M.end());
      for (int i = 0; i < L; i++)
        P[level][M[i].second] = (i > 0 && M[i].first == M[i - 1].first)
                                    ? P[level][M[i - 1].second]
                                    : i;
    }
  }
  vector<int> GetSuffixArray() { return P.back(); }
  int lcp(int i, int j) {
    int len = 0;
    if (i == j) return L - i;
    for (int k = P.size() - 1; k >= 0 && i < L && j < L; k--) {
      if (P[k][i] == P[k][j]) {
        i += 1 << k;
        j += 1 << k;
        len += 1 << k;
      }
    }
    return len;
  }
};
int main() {
  int k, tot = 0;
  cin >> s >> k;
  for (int i = 1; i <= s.length(); i++) dp[i][1] = 1;
  for (int l = 2; l <= s.length(); l++)
    for (int i = 1; i <= s.length(); i++)
      if ((i + l - 1) <= s.length()) {
        int ip = i + 2, jp = (i + l - 3);
        if (s[i - 1] == s[i + l - 2] && (ip >= jp || dp[ip][l - 4]))
          dp[i][l] = 1;
      }
  SuffixArray sfx(s);
  vector<int> rev = sfx.GetSuffixArray(), ans(s.length());
  for (int i = 0; i < rev.size(); i++) ans[rev[i]] = i;
  for (int i = 0; i < s.length(); i++)
    for (int l = (i > 0 ? sfx.lcp(ans[i], ans[i - 1]) + 1 : 1);
         ans[i] + l - 1 < s.length(); l++) {
      if (dp[ans[i] + 1][l])
        for (int x = i; x < s.length(); x++) {
          if (sfx.lcp(ans[i], ans[x]) >= l)
            tot++;
          else
            break;
          if (tot == k) {
            for (int z = 0; z < l; z++) putchar(s[ans[i] + z]);
            return 0;
          }
        }
    }
  return 0;
};
