#include <bits/stdc++.h>
using namespace std;
#define pb push_back
#define mod 1000000007
#define MEM(x,val) memset(x,val,sizeof(x))
#define ll long long
#define F first
#define S second
#define pii pair<int,int>
#define ALL(x) x.begin(),x.end()
#define FAST ios_base::sync_with_stdio(false);cin.tie(0);
int II(){int q;scanf("%d",&q);return q;}
ll LII(){ll q;scanf("%lld",&q);return q;}

void solve(){
	int M; cin>>M;
	string s; cin>>s;
	int N = (int)s.size();
	deque<int>de[30];
	for(int i = 0; i<N; i++){
		de[s[i]-'a'].pb(i);
	}
	map<int,int>mp;
	for(int i = 0; i<M; i++) mp[s[i]-'a']++;
	string ss = "";
	int prev_mi = 100, prev_in;
	for(int i = 0; i<26; i++){
		if(mp[i] > 0){
			prev_mi = i;
			ss += (char)(i + 'a');
			break;
		}
	}
	for(int i = M-1; i>=0; i--){
		if((s[i]-'a') == prev_mi){
			prev_in = i;
			break;
		}
	}
	de[s[0]-'a'].pop_front();
	for(int i = 1; i<N; i++){
		int q = i + M - 1;
		if(q >= N) break;
		mp[s[i-1]-'a']--;
		mp[s[i+M-1]-'a']++;
		int mi = 100;
		for(int j = 0; j<26; j++){
			if(mp[j] > 0){
				mi = j;
				break;
			}
		}
		if(mi == prev_mi){
			if(prev_in >= i) continue;
			int temp = 0;
			while(de[mi].size() > 0 && de[mi].front() <= q){
				temp = de[mi].front();
				de[mi].pop_front();
			}
			prev_in = temp;
			ss += (char)(mi + 'a');
		}else{
			int temp = 0;
			while(de[mi].size() > 0 && de[mi].front() <= q){
				temp = de[mi].front();
				de[mi].pop_front();
			}
			prev_in = temp;
			prev_mi = mi;
			ss += (mi + 'a');
		}
	}
	sort(ALL(ss));
  char ch = ss.back();
  map<char,int>mp1;
  string s1 = "";
  for(auto it:s) mp1[it]++;
  for(char cc = 'a'; cc<ch; cc++){
    int q = mp1[cc];
    while(q--) s1 += cc;
  }
  for(auto it:ss) if(it == ss.back()) s1 += it;
  cout<<s1<<endl;
}

int32_t main(){
  #ifndef ONLINE_JUDGE
  freopen("input.txt", "r", stdin);
  freopen("output.txt", "w", stdout);
  #endif
  int tt; tt = 1;
  int cas=1;
  while(tt--){
    //printf("Case %d: ",cas++);
    solve();
  }
}


#include <bits/stdc++.h>
using namespace std;
#define pb push_back
#define mod 1000000007
#define MEM(x,val) memset(x,val,sizeof(x))
#define ll long long
#define F first
#define S second
#define pii pair<int,int>
#define ALL(x) x.begin(),x.end()
#define FAST ios_base::sync_with_stdio(false);cin.tie(0);
int II(){int q;scanf("%d",&q);return q;}
ll LII(){ll q;scanf("%lld",&q);return q;}

void solve(){
	int M; cin>>M;
  string s; cin>>s;
  int N = (int) s.size();
  bool bo[N+N]; MEM(bo,0);
  string ss = "";
  for(int i = 0; i<N; i++){
    int j = i+M-1;
    if(j >= N) continue;
    int mi = 100;
    for(int k = i; k<=j; k++){
      mi = min(mi,s[k] - 'a');
    }
    int ww = 0;
    for(int k = i; k<=j; k++){
      if(bo[k] == 1 && (s[k]-'a') == mi){
        ww = 1;
        break;
      }
    }
    if(ww == 0){
      ss += (char)('a' + mi);
      for(int k = j; k>=i; k--){
        if((s[k] - 'a') == mi){
          bo[k] = 1;
          break;
        }
      }
    }
  }
  sort(ALL(ss));
  char ch = 'a';
  for(auto it:ss){
    if(it != ss.back()) ch = max(ch,it);
  }
  map<char,int>mp1;
  string s1 = "";
  for(auto it:s) mp1[it]++;
  for(char cc = 'a'; cc<=ch; cc++){
    int q = mp1[cc];
    while(q--) s1 += cc;
  }
  for(auto it:ss) if(it == ss.back() && ss.back() != ss.front()) s1 += it;
  cout<<s1<<endl;
}

int32_t main(){
  #ifndef ONLINE_JUDGE
  freopen("input.txt", "r", stdin);
  freopen("output.txt", "w", stdout);
  #endif
  int tt; tt = 1;
  int cas=1;
  while(tt--){
    //printf("Case %d: ",cas++);
    solve();
  }
}


#include <bits/stdc++.h>
using namespace std;
#define pb push_back
#define mod 1000000007
#define MEM(x,val) memset(x,val,sizeof(x))
#define ll long long
#define F first
#define S second
#define pii pair<int,int>
#define ALL(x) x.begin(),x.end()
#define FAST ios_base::sync_with_stdio(false);cin.tie(0);
int II(){int q;scanf("%d",&q);return q;}
ll LII(){ll q;scanf("%lld",&q);return q;}

void solve(){
	int M; cin>>M;
  string s; cin>>s;
  int N = (int) s.size();
  bool bo[N+N]; MEM(bo,0);
  string ss = "";
  for(int i = 0; i<N; i++){
    int j = i+M-1;
    if(j >= N) continue;
    int mi = 100;
    for(int k = i; k<=j; k++){
      mi = min(mi,s[k] - 'a');
    }
    int ww = 0;
    for(int k = i; k<=j; k++){
      if(bo[k] == 1 && (s[k]-'a') == mi){
        ww = 1;
        break;
      }
    }
    if(ww == 0){
      ss += (char)('a' + mi);
      for(int k = j; k>=i; k--){
        if((s[k] - 'a') == mi){
          bo[k] = 1;
          break;
        }
      }
    }
  }
  sort(ALL(ss));
  char ch = ss.back();
  map<char,int>mp1;
  string s1 = "";
  for(auto it:s) mp1[it]++;
  for(char cc = 'a'; cc<ch; cc++){
    int q = mp1[cc];
    while(q--) s1 += cc;
  }
  for(auto it:ss) if(it == ss.back() && ss.back() != ss.front()) s1 += it;
  cout<<s1<<endl;
}

int32_t main(){
  #ifndef ONLINE_JUDGE
  freopen("input.txt", "r", stdin);
  freopen("output.txt", "w", stdout);
  #endif
  int tt; tt = 1;
  int cas=1;
  while(tt--){
    //printf("Case %d: ",cas++);
    solve();
  }
}


/***************************************
	  Authur : zzblack                **
	  Created: 2016-10-03             **
	  Orz                             **
****************************************/
#include <set>
#include <map>
#include <queue>
#include <stack>
#include <ctime>
#include <cmath>
#include <string>
#include <cctype>
#include <cstdio>
#include <vector>
#include <bitset>
#include <cstdlib>
#include <cstring>
#include <iomanip>
#include <sstream>
#include <iostream>
#include <assert.h>
#include <algorithm>
using namespace std;
#define ls id<<1,l,mid
#define rs id<<1|1,mid+1,r
#define OFF(x) memset(x,-1,sizeof x)
#define CLR(x) memset(x,0,sizeof x)
#define MEM(x) memset(x,0x3f,sizeof x)
typedef long long ll ;
typedef unsigned long long ull ;
typedef pair<int,int> pii ;
const int maxn = 1e5 + 50 ;
const int maxm = 1e6 + 50;
const double eps = 1e-10;
const int max_index = 26;
const int inf = 0x3f3f3f3f ;
const int MOD = 1e9+7 ;
const double PI = acos(-1.);

inline int read(){
	char c = getchar();
	while (!isdigit(c)) c = getchar();
	int x = 0;
	while (isdigit(c)) {
		x = x * 10 + c - '0';
		c = getchar();
	}
	return x;
}
int vis[maxn];
int L[maxn], R[maxn];

int main () {
#ifdef LOCAL
	freopen("C:\\Users\\zzblack\\Desktop\\case.in","r",stdin);
	freopen("C:\\Users\\zzblack\\Desktop\\case.out","w",stdout);
#endif
	int m;cin >> m;
	string s;
	cin >> s;
	string ans;
	for (int ch = 'a'; ch <= 'z'; ch++) {
		int last = 0, cur = 0;
		for (int i = 0; s[i]; i++) {
			int loc = i+1;
			if (loc - m > last && cur > last && !vis[cur]) vis[cur] = 1, last = cur, ans += ch;
			if (s[i] == ch) cur = loc;
			if (vis[loc]) last = loc;
		}
		if (cur - m >= last && vis[cur] == 0) vis[cur] = 1, ans += ch;
	}
	cout << ans << endl;
	return 0;
}


/***************************************
	  Authur : zzblack                **
	  Created: 2016-10-03             **
	  Orz                             **
****************************************/
#include <set>
#include <map>
#include <queue>
#include <stack>
#include <ctime>
#include <cmath>
#include <string>
#include <cctype>
#include <cstdio>
#include <vector>
#include <bitset>
#include <cstdlib>
#include <cstring>
#include <iomanip>
#include <sstream>
#include <iostream>
#include <assert.h>
#include <algorithm>
using namespace std;
#define ls id<<1,l,mid
#define rs id<<1|1,mid+1,r
#define OFF(x) memset(x,-1,sizeof x)
#define CLR(x) memset(x,0,sizeof x)
#define MEM(x) memset(x,0x3f,sizeof x)
typedef long long ll ;
typedef unsigned long long ull ;
typedef pair<int,int> pii ;
const int maxn = 1e5 + 50 ;
const int maxm = 1e6 + 50;
const double eps = 1e-10;
const int max_index = 26;
const int inf = 0x3f3f3f3f ;
const int MOD = 1e9+7 ;
const double PI = acos(-1.);

inline int read(){
	char c = getchar();
	while (!isdigit(c)) c = getchar();
	int x = 0;
	while (isdigit(c)) {
		x = x * 10 + c - '0';
		c = getchar();
	}
	return x;
}
int vis[maxn];

int main () {
#ifdef LOCAL
	freopen("C:\\Users\\zzblack\\Desktop\\case.in","r",stdin);
	freopen("C:\\Users\\zzblack\\Desktop\\case.out","w",stdout);
#endif
	int m;cin >> m;
	string s;
	cin >> s;
	string ans;
	int last = 0;
	while (last + m - 1 < s.size()) {
		int id = last;char ch = ans.back();
		for (int i = 0; i < m && s[i+last]; i++) {
			if (s[i+last] <= s[id]) id = i + last;
			if (s[i+last] < ch) ans += s[i+last], id = i + last, vis[i+last] = 1;
		}
		last = id+1;
		if (s[id] >= ch) ans += s[id], vis[id] = 1;
	}
	sort(ans.begin(), ans.end());
	char ch = ans.back();
	for (int i = 0; s[i]; i++) if (s[i] < ch && !vis[i]) ans += s[i];
	sort(ans.begin(), ans.end());
	cout << ans << endl;

	// for (int ch = 'a'; ch <= 'z'; ch++) {
	// 	int last = 0, cur = 0;
	// 	for (int i = 0; s[i]; i++) {
	// 		int loc = i+1;
	// 		if (loc - m > last && cur > last && !vis[cur]) vis[cur] = 1, last = cur, ans += ch;
	// 		if (s[i] == ch) cur = loc;
	// 		if (vis[loc]) last = loc;
	// 	}
	// 	if (cur - m >= last && vis[cur] == 0) vis[cur] = 1, ans += ch;
	// }
	// cout << ans << endl;
	return 0;
}


/***************************************
	  Authur : zzblack                **
	  Created: 2016-10-03             **
	  Orz                             **
****************************************/
#include <set>
#include <map>
#include <queue>
#include <stack>
#include <ctime>
#include <cmath>
#include <string>
#include <cctype>
#include <cstdio>
#include <vector>
#include <bitset>
#include <cstdlib>
#include <cstring>
#include <iomanip>
#include <sstream>
#include <iostream>
#include <assert.h>
#include <algorithm>
using namespace std;
#define ls id<<1,l,mid
#define rs id<<1|1,mid+1,r
#define OFF(x) memset(x,-1,sizeof x)
#define CLR(x) memset(x,0,sizeof x)
#define MEM(x) memset(x,0x3f,sizeof x)
typedef long long ll ;
typedef unsigned long long ull ;
typedef pair<int,int> pii ;
const int maxn = 1e5 + 50 ;
const int maxm = 1e6 + 50;
const double eps = 1e-10;
const int max_index = 26;
const int inf = 0x3f3f3f3f ;
const int MOD = 1e9+7 ;
const double PI = acos(-1.);

inline int read(){
	char c = getchar();
	while (!isdigit(c)) c = getchar();
	int x = 0;
	while (isdigit(c)) {
		x = x * 10 + c - '0';
		c = getchar();
	}
	return x;
}
int vis[maxn];
int L[maxn], R[maxn];

int main () {
#ifdef LOCAL
	freopen("C:\\Users\\zzblack\\Desktop\\case.in","r",stdin);
	freopen("C:\\Users\\zzblack\\Desktop\\case.out","w",stdout);
#endif
	int m;cin >> m;
	string s;
	cin >> s;
	string ans;
	int last = 0;
	while (last + m - 1 < s.size()) {
		int id = last;char ch = ans.back();
		for (int i = 0; i < m && s[i+last]; i++) {
			if (s[i+last] <= s[id]) id = i + last;
			if (s[i+last] < ch) ans += s[i+last], id = i + last;
		}
		last = id+1;
		if (s[id] >= ch) ans += s[id];
	}
	char ch = ans.back();
	for (int i = last; s[i]; i++) if (s[i] < ch) ans += s[i];
	sort(ans.begin(), ans.end());
	cout << ans << endl;
	// for (int ch = 'a'; ch <= 'z'; ch++) {
	// 	int last = 0, cur = 0;
	// 	for (int i = 0; s[i]; i++) {
	// 		int loc = i+1;
	// 		if (loc - m > last && cur > last && !vis[cur]) vis[cur] = 1, last = cur, ans += ch;
	// 		if (s[i] == ch) cur = loc;
	// 		if (vis[loc]) last = loc;
	// 	}
	// 	if (cur - m >= last && vis[cur] == 0) vis[cur] = 1, ans += ch;
	// }
	// cout << ans << endl;
	return 0;
}


/***************************************
	  Authur : zzblack                **
	  Created: 2016-10-03             **
	  Orz                             **
****************************************/
#include <set>
#include <map>
#include <queue>
#include <stack>
#include <ctime>
#include <cmath>
#include <string>
#include <cctype>
#include <cstdio>
#include <vector>
#include <bitset>
#include <cstdlib>
#include <cstring>
#include <iomanip>
#include <sstream>
#include <iostream>
#include <assert.h>
#include <algorithm>
using namespace std;
#define ls id<<1,l,mid
#define rs id<<1|1,mid+1,r
#define OFF(x) memset(x,-1,sizeof x)
#define CLR(x) memset(x,0,sizeof x)
#define MEM(x) memset(x,0x3f,sizeof x)
typedef long long ll ;
typedef unsigned long long ull ;
typedef pair<int,int> pii ;
const int maxn = 1e5 + 50 ;
const int maxm = 1e6 + 50;
const double eps = 1e-10;
const int max_index = 26;
const int inf = 0x3f3f3f3f ;
const int MOD = 1e9+7 ;
const double PI = acos(-1.);

inline int read(){
	char c = getchar();
	while (!isdigit(c)) c = getchar();
	int x = 0;
	while (isdigit(c)) {
		x = x * 10 + c - '0';
		c = getchar();
	}
	return x;
}
int vis[maxn];
int L[maxn], R[maxn];

int main () {
#ifdef LOCAL
	freopen("C:\\Users\\zzblack\\Desktop\\case.in","r",stdin);
	freopen("C:\\Users\\zzblack\\Desktop\\case.out","w",stdout);
#endif
	int m;cin >> m;
	string s;
	cin >> s;
	string ans;
	for (int ch = 'a'; ch <= 'z'; ch++) {
		int last = 0, cur = 0;
		for (int i = 0; s[i]; i++) {
			int loc = i+1;
			if (loc - m > last && cur && !vis[cur]) vis[cur] = 1, last = cur, ans += ch;
			if (s[i] == ch) cur = loc;
			if (vis[loc]) last = loc;
		}
		if (cur - m >= last && vis[cur] == 0) vis[cur] = 1, ans += ch;
	}
	cout << ans << endl;
	return 0;
}


/***************************************
	  Authur : zzblack                **
	  Created: 2016-10-03             **
	  Orz                             **
****************************************/
#include <set>
#include <map>
#include <queue>
#include <stack>
#include <ctime>
#include <cmath>
#include <string>
#include <cctype>
#include <cstdio>
#include <vector>
#include <bitset>
#include <cstdlib>
#include <cstring>
#include <iomanip>
#include <sstream>
#include <iostream>
#include <assert.h>
#include <algorithm>
using namespace std;
#define ls id<<1,l,mid
#define rs id<<1|1,mid+1,r
#define OFF(x) memset(x,-1,sizeof x)
#define CLR(x) memset(x,0,sizeof x)
#define MEM(x) memset(x,0x3f,sizeof x)
typedef long long ll ;
typedef unsigned long long ull ;
typedef pair<int,int> pii ;
const int maxn = 1e5 + 50 ;
const int maxm = 1e6 + 50;
const double eps = 1e-10;
const int max_index = 26;
const int inf = 0x3f3f3f3f ;
const int MOD = 1e9+7 ;
const double PI = acos(-1.);

inline int read(){
	char c = getchar();
	while (!isdigit(c)) c = getchar();
	int x = 0;
	while (isdigit(c)) {
		x = x * 10 + c - '0';
		c = getchar();
	}
	return x;
}
int vis[maxn];
int L[maxn], R[maxn];

int main () {
#ifdef LOCAL
	freopen("C:\\Users\\zzblack\\Desktop\\case.in","r",stdin);
	freopen("C:\\Users\\zzblack\\Desktop\\case.out","w",stdout);
#endif
	int m;cin >> m;
	string s;
	cin >> s;
	string ans;
	for (int ch = 'a'; ch <= 'z'; ch++) {
		int last = 0, cur = 0;
		for (int i = 0; s[i]; i++) {
			int loc = i+1;
			if (i - m >= last && cur && !vis[cur]) vis[cur] = 1, last = cur, ans += ch;
			if (vis[loc]) last = loc;
			if (s[i] == ch) cur = loc;
		}
		if (cur - m >= last && vis[cur] == 0) vis[cur] = 1, ans += ch;
	}
	cout << ans << endl;
	return 0;
}


#include <bits/stdc++.h>

using namespace std;

char s[123456];

int main() {
  int n;
  scanf("%d", &n);
  scanf("%s", s);
  set < pair <char, int> > st;
  for (int i = 0; i < n; i++) {
    st.insert({s[i], -(i + 1)});
  }
  string ans = "";
  ans += string(1, (*st.begin()).first);
  int p = (*st.begin()).second;
  for (int i = n; s[i]; i++) {
    st.erase({s[i - n], -(i - n + 1)});
    st.insert({s[i], -(i + 1)});
    int x = (*st.begin()).second;
    if (x == p) continue;
    ans += string(1, (*st.begin()).first);
    p = x;
  }
  sort(ans.begin(), ans.end());
  cout << ans << endl;
  return 0;
}


#include <bits/stdc++.h>

using namespace std;

char s[123456];
int f[77];

int main() {
  int n;
  scanf("%d", &n);
  scanf("%s", s);
  set < pair <char, int> > st;
  for (int i = 0; i < n; i++) {
    st.insert({s[i], i});
  }
  char c = (*st.begin()).first;
  for (int i = n; s[i]; i++) {
    st.erase({s[i - n], i - n});
    st.insert({s[i], i});
    c = max(c, (*st.begin()).first);
  }
  string ans = "";
  for (int i = 0; s[i]; i++) {
    if (s[i] < c) ans += s[i];
  }
  memset(f, -1, sizeof(f));
  for (int i = 0; i < n; i++) {
    f[s[i] - 'a'] = i;
  }
  int p = 0;
  char chr = '-';
  for (int j = 0; j < c - 'a'; j++) {
    if (f[j] != -1 && f[j] > p) {
      p = f[j];
      chr = j + 'a';
    }
  }
  if (chr == '-') {
    p = f[c - 'a'];
    ans += c;
  }
  for (int i = n; s[i]; i++) {
    if (f[s[i - n] - 'a'] == i - n) {
      f[s[i - n] - 'a'] = -1;
    }
    f[s[i] - 'a'] = i;
    if (i - n + 1 <= p) continue;
    chr = '-';
    for (int j = 0; j < c - 'a'; j++) {
      if (f[j] != -1 && f[j] > p) {
        p = f[j];
        chr = j + 'a';
      }
    }
    if (chr == '-') {
      p = f[c - 'a'];
      ans += c;
    }
  }
  sort(ans.begin(), ans.end());
  cout << ans << endl;
  return 0;
}


#include <bits/stdc++.h>

using namespace std;

char s[123456];

int main() {
  int n;
  scanf("%d", &n);
  scanf("%s", s);
  set < pair <char, int> > st;
  for (int i = 0; i < n; i++) {
    st.insert({s[i], i});
  }
  char c = (*st.begin()).first;
  for (int i = n; s[i]; i++) {
    st.erase({s[i - n], i - n});
    st.insert({s[i], i});
    c = max(c, (*st.begin()).first);
  }
  string ans = "";
  for (int i = 0; s[i]; i++) {
    if (s[i] < c) ans += s[i];
  }
  st.clear();
  for (int i = 0; i < n; i++) {
    st.insert({s[i], i});
  }
  char x = (*st.begin()).first;
  if (x == c) ans += c;
  for (int i = n; s[i]; i++) {
    st.erase({s[i - n], {i - n}});
    st.insert({s[i], i});
    x = (*st.begin()).first;
    if (x == c) ans += c;
  }
  sort(ans.begin(), ans.end());
  cout << ans << endl;
  return 0;
}


#include <bits/stdc++.h>

using namespace std;

char s[123456];
int f[77];

int main() {
  int n;
  scanf("%d", &n);
  scanf("%s", s);
  set < pair <char, int> > st;
  for (int i = 0; i < n; i++) {
    st.insert({s[i], i});
  }
  char c = (*st.begin()).first;
  for (int i = n; s[i]; i++) {
    st.erase({s[i - n], i - n});
    st.insert({s[i], i});
    c = max(c, (*st.begin()).first);
  }
  string ans = "";
  for (int i = 0; s[i]; i++) {
    if (s[i] < c) ans += s[i];
  }
  memset(f, -1, sizeof(f));
  for (int i = 0; i < n; i++) {
    f[s[i] - 'a'] = i;
  }
  int p = -1;
  char chr = '-';
  for (int j = 0; j < c - 'a'; j++) {
    if (f[j] != -1 && f[j] > p) {
      p = f[j];
      chr = j + 'a';
    }
  }
  if (chr == '-') {
    p = f[c - 'a'];
    ans += c;
  }
  for (int i = n; s[i]; i++) {
    if (f[s[i - n] - 'a'] == i - n) {
      f[s[i - n] - 'a'] = -1;
    }
    f[s[i] - 'a'] = i;
    if (i - n + 1 <= p) continue;
    chr = '-';
    for (int j = 0; j < c - 'a'; j++) {
      if (f[j] != -1 && f[j] > p) {
        p = f[j];
        chr = j + 'a';
      }
    }
    if (chr == '-') {
      p = f[c - 'a'];
      ans += c;
    }
  }
  sort(ans.begin(), ans.end());
  cout << ans << endl;
  return 0;
}


#pragma comment(linker, "/STACK:102400000,102400000")
#include <bits/stdc++.h>

typedef long long LLONG;
typedef long long ULLONG;
typedef std::pair<int, int>PII;
#define dout(x) std::cout << #x << " = " << x << std::endl;
#define LSON v << 1
#define RSON v << 1 | 1
#define TMID int mid = l + r >> 1

const int N = 1e5 + 10;
const int MOD = 1e9 + 7;
const int K = 20;

std::string s;
bool vis[N];

inline bool check(int n) {
  int last = -1;
  for (int i = 0; i < n; ++i)
    if (vis[i]) {
      last = i;
    }
  if (!~last) return false;
  for (int i = n; i < s.size(); ++i) {
    if (vis[i]) {
      last = i;
    }
    if (i - last >= n) {
      return false;
    }
  }
  return true;
}

inline void shrink(int n, int k) {
  int last = -1 , vlast = -1;
  for (int i = 0; i < n; ++i) {
    if (s[i] == k) {
      last = i;
    }
    if (vis[i]) {
      vlast = i;
    }
  }
  if (!~vlast) {
    vis[last] = true;
  }
  for (int i = n; i < s.size(); ++i) {
    if (s[i] == k) {
      last = i;
    }
    if (vis[i]) {
      vlast = i;
    }
    if (i - vlast >= n) {
      vis[last] = true;
      vlast = last;
    }
  }
}

int main() {
  int n;
  scanf("%d", &n);
  std::cin >> s;
  int mx = 'z' + 1;
  for (int i = 0; i < s.size(); ++i) {
    mx = std::min((int)s[i], mx);
  }
  for (int k = 0; k < 30; ++k) {
    for (int i = 0; i < s.size(); ++i) {
      if (s[i] == mx + k) {
        vis[i] = true;
      }
    }
    if (check(n)) {
      for (int i = 0; i < s.size(); ++i) {
        if (s[i] == mx + k) {
          vis[i] = false;
        }
      }
      shrink(n, k + mx);
      break;
    }
  }
  std::string rlt;
  for (int i = 0; i < s.size(); ++i) {
    if (vis[i]) {
      rlt += s[i];
    }
  }
  std::sort(rlt.begin(), rlt.end());
  std::cout << rlt << std::endl;
  return 0;
}


#include <bits/stdc++.h>
using namespace std;

typedef pair<char, int> pci;

#define fst first
#define snd second
bool vis[100010];

int main(void) {
    int m;
    cin >> m;
    string s;
    cin >> s;
    int n = s.length();

    string ans = "";
    priority_queue<pci, vector<pci>, greater<pci>> pq, tmpq;
    for (int i = 0; i < m && i < n; ++ i) pq.push(pci(s[i], -i)), vis[i] = true;
    ans.push_back(pq.top().fst);
    int i = -pq.top().snd;
    pq.pop();

    char maxCh = ans.back();
    while (i < n) {
        int k = i + 1;
        //if (k + m > n) break;
        for (int j = k; j < k + m && j < n; ++ j) if (!vis[j]) {
            tmpq.push(pci(s[j], -j));
        }
        if (tmpq.empty()) break;
        int ii = i;
        while (!pq.empty() && pq.top() < tmpq.top()) {
            ans.push_back(pq.top().fst);
            maxCh = max(maxCh, ans.back());
            ii = max(ii, -pq.top().snd);
            pq.pop();
        }
        if (ii > i) {
            i = ii;
            continue;
        }

        if (k + m > n && maxCh <= tmpq.top().fst) break;

        for (int j = k; j < k + m && j < n; ++ j) vis[j] = true;
        ans.push_back(tmpq.top().fst);
        maxCh = max(maxCh, ans.back());
        i = max(i, -tmpq.top().snd);
        tmpq.pop();
        while (!tmpq.empty()) pq.push(tmpq.top()), tmpq.pop();
    }

    while (!pq.empty() && pq.top().fst < maxCh) {
        ans.push_back(pq.top().fst); pq.pop();
    }

    sort(begin(ans), end(ans));
    cout << ans << endl;

    return 0;
}


#include <bits/stdc++.h>
using namespace std;

typedef pair<char, int> pci;

#define fst first
#define snd second
bool vis[100010];

int main(void) {
    int m;
    cin >> m;
    string s;
    cin >> s;
    int n = s.length();

    string ans = "";
    priority_queue<pci, vector<pci>, greater<pci>> pq, tmpq;
    for (int i = 0; i < m && i < n; ++ i) pq.push(pci(s[i], -i)), vis[i] = true;
    ans.push_back(pq.top().fst);
    int i = -pq.top().snd;
    pq.pop();

    char maxCh = ans.back();
    while (i < n) {
        int k = i + 1;
        //if (k + m > n) break;
        for (int j = k; j < k + m && j < n; ++ j) if (!vis[j]) {
            tmpq.push(pci(s[j], -j));
        }
        if (tmpq.empty()) break;

        int ii = i;
        while (!pq.empty() && pq.top() < tmpq.top()) {
            ans.push_back(pq.top().fst);
            maxCh = max(maxCh, ans.back());
            ii = max(ii, -pq.top().snd);
            pq.pop();
        }
        if (ii > i) {
            i = ii;
            while (!tmpq.empty()) tmpq.pop();
            continue;
        }

        if (k + m > n && maxCh <= tmpq.top().fst) break;

        for (int j = k; j < k + m && j < n; ++ j) vis[j] = true;

        if (!vis[tmpq.top().snd]) {
            ans.push_back(tmpq.top().fst);
            maxCh = max(maxCh, ans.back());
            i = max(i, -tmpq.top().snd);
            tmpq.pop();
        }
        while (!tmpq.empty()) pq.push(tmpq.top()), tmpq.pop();
    }

    while (!pq.empty() && pq.top().fst < maxCh) {
        if (!vis[pq.top().snd]) {
            ans.push_back(pq.top().fst); pq.pop();
        }
    }

    sort(begin(ans), end(ans));
    cout << ans << endl;

    return 0;
}


#include <bits/stdc++.h>
using namespace std;

typedef pair<char, int> pci;

#define fst first
#define snd second
bool vis[100010];

int main(void) {
    int m;
    cin >> m;
    string s;
    cin >> s;
    int n = s.length();

    string ans = "";
    priority_queue<pci, vector<pci>, greater<pci>> pq, tmpq;
    for (int i = 0; i < m; ++ i) pq.push(pci(s[i], -i)), vis[i] = true;
    ans.push_back(pq.top().fst);
    int i = -pq.top().snd;
    pq.pop();

    char maxCh = ans.back();
    while (i < n) {
        int k = i + 1;
        //if (k + m > n) break;
        for (int j = k; j < k + m && j < n; ++ j) if (!vis[j]) {
            tmpq.push(pci(s[j], -j));
        }
        if (tmpq.empty()) break;
        int ii = i;
        while (!pq.empty() && pq.top() < tmpq.top()) {
            ans.push_back(pq.top().fst);
            maxCh = max(maxCh, ans.back());
            ii = max(ii, -pq.top().snd);
            pq.pop();
        }
        if (ii > i) {
            i = ii;
            continue;
        }

        if (k + m > n && maxCh <= tmpq.top().fst) break;

        for (int j = k; j < k + m && j < n; ++ j) vis[j] = true;
        ans.push_back(tmpq.top().fst);
        maxCh = max(maxCh, ans.back());
        i = max(i, -tmpq.top().snd);
        tmpq.pop();
        while (!tmpq.empty()) pq.push(tmpq.top()), tmpq.pop();
    }

    while (!pq.empty() && pq.top().fst < maxCh) {
        ans.push_back(pq.top().fst); pq.pop();
    }

    sort(begin(ans), end(ans));
    cout << ans << endl;

    return 0;
}


#include <bits/stdc++.h>

using namespace std;

#define READ() 	    freopen("in.txt","r",stdin)
#define WRITE()     freopen("out.txt","w",stdout)
#define sf(n) 	    scanf("%d",&n)
#define sl(x)       scanf("%I64d",&x)
#define lsf(n) 	    scanf("%lld", &n)
#define pb(n) 	    push_back(n)
#define mem(x,y)    memset(x,y,sizeof(x))
#define DBG(x)      cout << #x << " = " << x << endl
#define YOLO        cout << "YOLO" << endl
#define NL			printf("\n")
#define EPS 	    1e-10
#define INF         INT_MAX
#define MAX         INT_MAX
#define MOD         1000000007
#define LL          long long
#define endl        "\n"
#define pi          2.0*acos(0.0)
#define cnd         tree[idx]
#define lnd         tree[left]
#define rnd         tree[right]
#define callLeft    left,st,mid
#define callRight   right,mid+1,ed

///// ******************************** Segment Tree Starts *********************************************
//
//
//struct node
//{
//    LL sum = 0;
//    LL lazyCall = 0;
//
//    node()
//    {
//        sum = 0;
//        lazyCall = 0;
//    }
//};
//
//node tree[4*MAX];
////LL arr[MAX];
//
//void updateNode(int idx,int st,int ed,int v)
//{
//    cnd.sum += v;
//
////    cnd.flipCnt = 0;
//}
//
//void updateLazy(int idx,int st,int ed,int i,int j)
//{
//    int left = idx<<1;
//    int right = left+1;
//    int mid = (st+ed)>>1;
//
//    updateNode(callLeft,cnd.lazyCall);
//    updateNode(callRight,cnd.lazyCall);
//
//    cnd.lazyCall = 0;
//}
//
//void mergeNodes(int idx,int left,int right)
//{
//    cnd.sum = (lnd.sum + rnd.sum);
//}
//
//void build(int idx,int st,int ed)
//{
//    if(st == ed)
//    {
//        cnd.zero = 1;
//        cnd.one = 0;
//        cnd.two = 0;
//        cnd.flipCnt = 0;
//        return;
//    }
//    int left = idx*2;
//    int right = left+1;
//    int mid = (st+ed)/2;
//
//    build(callLeft);
//    build(callRight);
//    cnd.zero = (lnd.zero + rnd.zero);
//}
//
//void update(int idx,int st,int ed,int i,int j,int v)
//{
//    if(i > ed || j < st)return;
//    if(st >= i && ed <= j)
//    {
//        updateNode(idx,st,ed,v);
//        return;
//    }
//    int left = idx<<1;
//    int right = left+1;
//    int mid = (st+ed)>>1;
//
//    if(cnd.flipCnt) /// update_lazy
//    {
//        updateLazy(idx,st,ed,i,j);
//    }
//
//    update(callLeft,i,j,v);
//    update(callRight,i,j,v);
//
//    mergeNodes(idx,left,right);
//}
//
//LL query(int idx,int st,int ed,int i,int j)
//{
//    if(i > ed || j < st)return 0;
//    if(st >= i && ed <= j)
//    {
//        return cnd.zero;
//    }
//
//    int left = idx<<1;
//    int right = left+1;
//    int mid = (st+ed)>>1;
//
//    if(cnd.flipCnt)/// update_lazy
//    {
//        updateLazy(idx,st,ed,i,j);
//    }
//    return (query(callLeft,i,j) + query(callRight,i,j));
//}
///// ******************************** Segment Tree Ends *********************************************

vector <int> vec[200]; /// 97 to 97+26

int main()
{
//	ios_base::sync_with_stdio(false);
//    cin.tie(0); /// use "\n" instead of endl
//    READ();
//    WRITE();

    int m;
    cin >> m;
    string s;
    cin >> s;
    set <int> st;
    for(int i=0;i<s.size();i++)
    {
        int x = s[i];
        vec[x].pb(i+1);
        if(i+1 <= s.size()-m+1)
        {
            st.insert(i+1);
        }

    }
    string sAns;
    string sMain = "";
    for(int i=97;i<97+26 && !st.empty();i++)
    {
        if(i > 97)
        {
            for(int j=0;j<vec[i-1].size();j++)
            {
                char c = i-1;
                sMain += c;
            }
        }
        sAns = "";
        for(int j=0;j<vec[i].size() && !st.empty();j++)
        {
            int id = vec[i][j];
            bool used = false;
            for(int k = id;k>=id-m+1;k--)
            {
                if(st.find(k) != st.end())
                {
                    st.erase(st.find(k));
                    used = true;
                }
//                    break;
            }
            if(used)
            {
                char c = i;
                sAns += c;
//                DBG(sAns);
            }

        }
    }
    cout << sMain+sAns << endl;

//	main();
    return 0;
}


#include <bits/stdc++.h>

using namespace std;

#define READ() 	    freopen("in.txt","r",stdin)
#define WRITE()     freopen("out.txt","w",stdout)
#define sf(n) 	    scanf("%d",&n)
#define sl(x)       scanf("%I64d",&x)
#define lsf(n) 	    scanf("%lld", &n)
#define pb(n) 	    push_back(n)
#define mem(x,y)    memset(x,y,sizeof(x))
#define DBG(x)      cout << #x << " = " << x << endl
#define YOLO        cout << "YOLO" << endl
#define NL			printf("\n")
#define EPS 	    1e-10
#define INF         INT_MAX
#define MAX         INT_MAX
#define MOD         1000000007
#define LL          long long
#define endl        "\n"
#define pi          2.0*acos(0.0)
#define cnd         tree[idx]
#define lnd         tree[left]
#define rnd         tree[right]
#define callLeft    left,st,mid
#define callRight   right,mid+1,ed

///// ******************************** Segment Tree Starts *********************************************
//
//
//struct node
//{
//    LL sum = 0;
//    LL lazyCall = 0;
//
//    node()
//    {
//        sum = 0;
//        lazyCall = 0;
//    }
//};
//
//node tree[4*MAX];
////LL arr[MAX];
//
//void updateNode(int idx,int st,int ed,int v)
//{
//    cnd.sum += v;
//
////    cnd.flipCnt = 0;
//}
//
//void updateLazy(int idx,int st,int ed,int i,int j)
//{
//    int left = idx<<1;
//    int right = left+1;
//    int mid = (st+ed)>>1;
//
//    updateNode(callLeft,cnd.lazyCall);
//    updateNode(callRight,cnd.lazyCall);
//
//    cnd.lazyCall = 0;
//}
//
//void mergeNodes(int idx,int left,int right)
//{
//    cnd.sum = (lnd.sum + rnd.sum);
//}
//
//void build(int idx,int st,int ed)
//{
//    if(st == ed)
//    {
//        cnd.zero = 1;
//        cnd.one = 0;
//        cnd.two = 0;
//        cnd.flipCnt = 0;
//        return;
//    }
//    int left = idx*2;
//    int right = left+1;
//    int mid = (st+ed)/2;
//
//    build(callLeft);
//    build(callRight);
//    cnd.zero = (lnd.zero + rnd.zero);
//}
//
//void update(int idx,int st,int ed,int i,int j,int v)
//{
//    if(i > ed || j < st)return;
//    if(st >= i && ed <= j)
//    {
//        updateNode(idx,st,ed,v);
//        return;
//    }
//    int left = idx<<1;
//    int right = left+1;
//    int mid = (st+ed)>>1;
//
//    if(cnd.flipCnt) /// update_lazy
//    {
//        updateLazy(idx,st,ed,i,j);
//    }
//
//    update(callLeft,i,j,v);
//    update(callRight,i,j,v);
//
//    mergeNodes(idx,left,right);
//}
//
//LL query(int idx,int st,int ed,int i,int j)
//{
//    if(i > ed || j < st)return 0;
//    if(st >= i && ed <= j)
//    {
//        return cnd.zero;
//    }
//
//    int left = idx<<1;
//    int right = left+1;
//    int mid = (st+ed)>>1;
//
//    if(cnd.flipCnt)/// update_lazy
//    {
//        updateLazy(idx,st,ed,i,j);
//    }
//    return (query(callLeft,i,j) + query(callRight,i,j));
//}
///// ******************************** Segment Tree Ends *********************************************

vector <int> vec[200]; /// 97 to 97+26

int main()
{
//	ios_base::sync_with_stdio(false);
//    cin.tie(0); /// use "\n" instead of endl
//    READ();
//    WRITE();

    int m;
    cin >> m;
    string s;
    cin >> s;
    set <int> st;
    for(int i=0;i<s.size();i++)
    {
        int x = s[i];
        vec[x].pb(i+1);
        if(i+1 <= s.size()-m+1)
        {
            st.insert(i+1);
        }

    }
    string sAns;
    string sMain = "";
    for(int i=97;i<97+26 && !st.empty();i++)
    {
        if(i > 97)
        {
            for(int j=0;j<vec[i-1].size();j++)
            {
                char c = i-1;
                sMain += c;
            }
        }
        sAns = "";
        for(int j=0;j<vec[i].size() && !st.empty();j++)
        {
            int id = vec[i][j];
            bool used = false;
            for(int k = id;k>=max(1,id-m+1);k--)
            {
                if(st.find(k) != st.end())
                {
                    st.erase(k);
                    used = true;
                }
//                    break;
            }
            if(used)
            {
                char c = i;
                sAns += c;
//                DBG(sAns);
            }

        }
    }
    cout << sMain+sAns << endl;

//	main();
    return 0;
}


#include <bits/stdc++.h>

using namespace std;

#define READ() 	    freopen("in.txt","r",stdin)
#define WRITE()     freopen("out.txt","w",stdout)
#define sf(n) 	    scanf("%d",&n)
#define sl(x)       scanf("%I64d",&x)
#define lsf(n) 	    scanf("%lld", &n)
#define pb(n) 	    push_back(n)
#define mem(x,y)    memset(x,y,sizeof(x))
#define DBG(x)      cout << #x << " = " << x << endl
#define YOLO        cout << "YOLO" << endl
#define NL			printf("\n")
#define EPS 	    1e-10
#define INF         INT_MAX
#define MAX         INT_MAX
#define MOD         1000000007
#define LL          long long
#define endl        "\n"
#define pi          2.0*acos(0.0)
#define cnd         tree[idx]
#define lnd         tree[left]
#define rnd         tree[right]
#define callLeft    left,st,mid
#define callRight   right,mid+1,ed

///// ******************************** Segment Tree Starts *********************************************
//
//
//struct node
//{
//    LL sum = 0;
//    LL lazyCall = 0;
//
//    node()
//    {
//        sum = 0;
//        lazyCall = 0;
//    }
//};
//
//node tree[4*MAX];
////LL arr[MAX];
//
//void updateNode(int idx,int st,int ed,int v)
//{
//    cnd.sum += v;
//
////    cnd.flipCnt = 0;
//}
//
//void updateLazy(int idx,int st,int ed,int i,int j)
//{
//    int left = idx<<1;
//    int right = left+1;
//    int mid = (st+ed)>>1;
//
//    updateNode(callLeft,cnd.lazyCall);
//    updateNode(callRight,cnd.lazyCall);
//
//    cnd.lazyCall = 0;
//}
//
//void mergeNodes(int idx,int left,int right)
//{
//    cnd.sum = (lnd.sum + rnd.sum);
//}
//
//void build(int idx,int st,int ed)
//{
//    if(st == ed)
//    {
//        cnd.zero = 1;
//        cnd.one = 0;
//        cnd.two = 0;
//        cnd.flipCnt = 0;
//        return;
//    }
//    int left = idx*2;
//    int right = left+1;
//    int mid = (st+ed)/2;
//
//    build(callLeft);
//    build(callRight);
//    cnd.zero = (lnd.zero + rnd.zero);
//}
//
//void update(int idx,int st,int ed,int i,int j,int v)
//{
//    if(i > ed || j < st)return;
//    if(st >= i && ed <= j)
//    {
//        updateNode(idx,st,ed,v);
//        return;
//    }
//    int left = idx<<1;
//    int right = left+1;
//    int mid = (st+ed)>>1;
//
//    if(cnd.flipCnt) /// update_lazy
//    {
//        updateLazy(idx,st,ed,i,j);
//    }
//
//    update(callLeft,i,j,v);
//    update(callRight,i,j,v);
//
//    mergeNodes(idx,left,right);
//}
//
//LL query(int idx,int st,int ed,int i,int j)
//{
//    if(i > ed || j < st)return 0;
//    if(st >= i && ed <= j)
//    {
//        return cnd.zero;
//    }
//
//    int left = idx<<1;
//    int right = left+1;
//    int mid = (st+ed)>>1;
//
//    if(cnd.flipCnt)/// update_lazy
//    {
//        updateLazy(idx,st,ed,i,j);
//    }
//    return (query(callLeft,i,j) + query(callRight,i,j));
//}
///// ******************************** Segment Tree Ends *********************************************

vector <int> vec[200]; /// 97 to 97+26

int main()
{
//	ios_base::sync_with_stdio(false);
//    cin.tie(0); /// use "\n" instead of endl
//    READ();
//    WRITE();

    int m;
    cin >> m;
    string s;
    cin >> s;
    set <int> st;
    for(int i=0;i<s.size();i++)
    {
        int x = s[i];
        vec[x].pb(i+1);
//        if(i+1 <= s.size()-m+1)
//        {
//            st.insert(i+1);
//        }

    }
    string sAns;
    string sMain = "";
    for(int i=97;i<97+26 && !st.empty();i++)
    {
        if(i > 97)
        {
            for(int j=0;j<vec[i-1].size();j++)
            {
                char c = i-1;
                sMain += c;
            }
        }
        sAns = "";
        for(int j=vec[i].size()-1;j>=0 && !st.empty();j--)
        {
            int id = vec[i][j];
            bool used = false;
            for(int k = id;k>=max(1,id-m+1);k--)
            {
                if(st.find(k) != st.end())
                {
                    st.erase(k);
                    used = true;
                }
//                    break;
            }
            if(used)
            {
                char c = i;
                sAns += c;
//                DBG(sAns);
            }

        }
    }
    cout << sMain+sAns << endl;

//	main();
    return 0;
}


#include <bits/stdc++.h>

using namespace std;

#define READ() 	    freopen("in.txt","r",stdin)
#define WRITE()     freopen("out.txt","w",stdout)
#define sf(n) 	    scanf("%d",&n)
#define sl(x)       scanf("%I64d",&x)
#define lsf(n) 	    scanf("%lld", &n)
#define pb(n) 	    push_back(n)
#define mem(x,y)    memset(x,y,sizeof(x))
#define DBG(x)      cout << #x << " = " << x << endl
#define YOLO        cout << "YOLO" << endl
#define NL			printf("\n")
#define EPS 	    1e-10
#define INF         INT_MAX
#define MAX         INT_MAX
#define MOD         1000000007
#define LL          long long
#define endl        "\n"
#define pi          2.0*acos(0.0)
#define cnd         tree[idx]
#define lnd         tree[left]
#define rnd         tree[right]
#define callLeft    left,st,mid
#define callRight   right,mid+1,ed

///// ******************************** Segment Tree Starts *********************************************
//
//
//struct node
//{
//    LL sum = 0;
//    LL lazyCall = 0;
//
//    node()
//    {
//        sum = 0;
//        lazyCall = 0;
//    }
//};
//
//node tree[4*MAX];
////LL arr[MAX];
//
//void updateNode(int idx,int st,int ed,int v)
//{
//    cnd.sum += v;
//
////    cnd.flipCnt = 0;
//}
//
//void updateLazy(int idx,int st,int ed,int i,int j)
//{
//    int left = idx<<1;
//    int right = left+1;
//    int mid = (st+ed)>>1;
//
//    updateNode(callLeft,cnd.lazyCall);
//    updateNode(callRight,cnd.lazyCall);
//
//    cnd.lazyCall = 0;
//}
//
//void mergeNodes(int idx,int left,int right)
//{
//    cnd.sum = (lnd.sum + rnd.sum);
//}
//
//void build(int idx,int st,int ed)
//{
//    if(st == ed)
//    {
//        cnd.zero = 1;
//        cnd.one = 0;
//        cnd.two = 0;
//        cnd.flipCnt = 0;
//        return;
//    }
//    int left = idx*2;
//    int right = left+1;
//    int mid = (st+ed)/2;
//
//    build(callLeft);
//    build(callRight);
//    cnd.zero = (lnd.zero + rnd.zero);
//}
//
//void update(int idx,int st,int ed,int i,int j,int v)
//{
//    if(i > ed || j < st)return;
//    if(st >= i && ed <= j)
//    {
//        updateNode(idx,st,ed,v);
//        return;
//    }
//    int left = idx<<1;
//    int right = left+1;
//    int mid = (st+ed)>>1;
//
//    if(cnd.flipCnt) /// update_lazy
//    {
//        updateLazy(idx,st,ed,i,j);
//    }
//
//    update(callLeft,i,j,v);
//    update(callRight,i,j,v);
//
//    mergeNodes(idx,left,right);
//}
//
//LL query(int idx,int st,int ed,int i,int j)
//{
//    if(i > ed || j < st)return 0;
//    if(st >= i && ed <= j)
//    {
//        return cnd.zero;
//    }
//
//    int left = idx<<1;
//    int right = left+1;
//    int mid = (st+ed)>>1;
//
//    if(cnd.flipCnt)/// update_lazy
//    {
//        updateLazy(idx,st,ed,i,j);
//    }
//    return (query(callLeft,i,j) + query(callRight,i,j));
//}
///// ******************************** Segment Tree Ends *********************************************

vector <int> vec[200]; /// 97 to 97+26

int main()
{
//	ios_base::sync_with_stdio(false);
//    cin.tie(0); /// use "\n" instead of endl
//    READ();
//    WRITE();

    int m;
    cin >> m;
    string s;
    cin >> s;
    set <int> st;
    for(int i=0;i<s.size();i++)
    {
        int x = s[i];
        vec[x].pb(i+1);
        if(i+1 <= s.size()-m+1)
        {
            st.insert(i+1);
        }

    }
    string sAns = "";
    for(int i=97;i<97+26 && !st.empty();i++)
    {
        for(int j=vec[i].size()-1;j>=0 && !st.empty();j--)
        {
            int id = vec[i][j];
            bool used = false;
            for(int k = id;k>=id-m+1;k--)
            {
                if(st.find(k) != st.end())
                {
                    st.erase(k);
                    used = true;
                }
//                    break;
            }
            if(used)
            {
                char c = i;
                sAns += c;
//                DBG(sAns);
            }

        }
    }
    cout << sAns << endl;

//	main();
    return 0;
}


#include <bits/stdc++.h>

using namespace std;

#define READ() 	    freopen("in.txt","r",stdin)
#define WRITE()     freopen("out.txt","w",stdout)
#define sf(n) 	    scanf("%d",&n)
#define sl(x)       scanf("%I64d",&x)
#define lsf(n) 	    scanf("%lld", &n)
#define pb(n) 	    push_back(n)
#define mem(x,y)    memset(x,y,sizeof(x))
#define DBG(x)      cout << #x << " = " << x << endl
#define YOLO        cout << "YOLO" << endl
#define NL			printf("\n")
#define EPS 	    1e-10
#define INF         INT_MAX
#define MAX         INT_MAX
#define MOD         1000000007
#define LL          long long
#define endl        "\n"
#define pi          2.0*acos(0.0)
#define cnd         tree[idx]
#define lnd         tree[left]
#define rnd         tree[right]
#define callLeft    left,st,mid
#define callRight   right,mid+1,ed

///// ******************************** Segment Tree Starts *********************************************
//
//
//struct node
//{
//    LL sum = 0;
//    LL lazyCall = 0;
//
//    node()
//    {
//        sum = 0;
//        lazyCall = 0;
//    }
//};
//
//node tree[4*MAX];
////LL arr[MAX];
//
//void updateNode(int idx,int st,int ed,int v)
//{
//    cnd.sum += v;
//
////    cnd.flipCnt = 0;
//}
//
//void updateLazy(int idx,int st,int ed,int i,int j)
//{
//    int left = idx<<1;
//    int right = left+1;
//    int mid = (st+ed)>>1;
//
//    updateNode(callLeft,cnd.lazyCall);
//    updateNode(callRight,cnd.lazyCall);
//
//    cnd.lazyCall = 0;
//}
//
//void mergeNodes(int idx,int left,int right)
//{
//    cnd.sum = (lnd.sum + rnd.sum);
//}
//
//void build(int idx,int st,int ed)
//{
//    if(st == ed)
//    {
//        cnd.zero = 1;
//        cnd.one = 0;
//        cnd.two = 0;
//        cnd.flipCnt = 0;
//        return;
//    }
//    int left = idx*2;
//    int right = left+1;
//    int mid = (st+ed)/2;
//
//    build(callLeft);
//    build(callRight);
//    cnd.zero = (lnd.zero + rnd.zero);
//}
//
//void update(int idx,int st,int ed,int i,int j,int v)
//{
//    if(i > ed || j < st)return;
//    if(st >= i && ed <= j)
//    {
//        updateNode(idx,st,ed,v);
//        return;
//    }
//    int left = idx<<1;
//    int right = left+1;
//    int mid = (st+ed)>>1;
//
//    if(cnd.flipCnt) /// update_lazy
//    {
//        updateLazy(idx,st,ed,i,j);
//    }
//
//    update(callLeft,i,j,v);
//    update(callRight,i,j,v);
//
//    mergeNodes(idx,left,right);
//}
//
//LL query(int idx,int st,int ed,int i,int j)
//{
//    if(i > ed || j < st)return 0;
//    if(st >= i && ed <= j)
//    {
//        return cnd.zero;
//    }
//
//    int left = idx<<1;
//    int right = left+1;
//    int mid = (st+ed)>>1;
//
//    if(cnd.flipCnt)/// update_lazy
//    {
//        updateLazy(idx,st,ed,i,j);
//    }
//    return (query(callLeft,i,j) + query(callRight,i,j));
//}
///// ******************************** Segment Tree Ends *********************************************

vector <int> vec[200]; /// 97 to 97+26

int main()
{
//	ios_base::sync_with_stdio(false);
//    cin.tie(0); /// use "\n" instead of endl
//    READ();
//    WRITE();

    int m;
    cin >> m;
    string s;
    cin >> s;
    set <int> st;
    for(int i=0;i<s.size();i++)
    {
        int x = s[i];
        vec[x].pb(i+1);
        if(i+1 <= s.size()-m+1)
        {
            st.insert(i+1);
        }

    }
    string sAns;
    string sMain = "";
    for(int i=97;i<97+26 && !st.empty();i++)
    {
        if(i > 97)
        {
            for(int j=0;j<vec[i-1].size();j++)
            {
                char c = i-1;
                sMain += c;
            }
        }
        sAns = "";
        for(int j=0;j<vec[i].size() && !st.empty();j++)
        {
            int id = vec[i][j];
            bool used = false;
            for(int k = id;k>=max(1,id-m+1);k--)
            {
                if(st.find(k) != st.end())
                {
                    st.erase(st.find(k));
                    used = true;
                }
//                    break;
            }
            if(used)
            {
                char c = i;
                sAns += c;
//                DBG(sAns);
            }

        }
    }
    cout << sMain+sAns << endl;

//	main();
    return 0;
}


#include <bits/stdc++.h>

using namespace std;

#define READ() 	    freopen("in.txt","r",stdin)
#define WRITE()     freopen("out.txt","w",stdout)
#define sf(n) 	    scanf("%d",&n)
#define sl(x)       scanf("%I64d",&x)
#define lsf(n) 	    scanf("%lld", &n)
#define pb(n) 	    push_back(n)
#define mem(x,y)    memset(x,y,sizeof(x))
#define DBG(x)      cout << #x << " = " << x << endl
#define YOLO        cout << "YOLO" << endl
#define NL			printf("\n")
#define EPS 	    1e-10
#define INF         INT_MAX
#define MAX         INT_MAX
#define MOD         1000000007
#define LL          long long
#define endl        "\n"
#define pi          2.0*acos(0.0)
#define cnd         tree[idx]
#define lnd         tree[left]
#define rnd         tree[right]
#define callLeft    left,st,mid
#define callRight   right,mid+1,ed

///// ******************************** Segment Tree Starts *********************************************
//
//
//struct node
//{
//    LL sum = 0;
//    LL lazyCall = 0;
//
//    node()
//    {
//        sum = 0;
//        lazyCall = 0;
//    }
//};
//
//node tree[4*MAX];
////LL arr[MAX];
//
//void updateNode(int idx,int st,int ed,int v)
//{
//    cnd.sum += v;
//
////    cnd.flipCnt = 0;
//}
//
//void updateLazy(int idx,int st,int ed,int i,int j)
//{
//    int left = idx<<1;
//    int right = left+1;
//    int mid = (st+ed)>>1;
//
//    updateNode(callLeft,cnd.lazyCall);
//    updateNode(callRight,cnd.lazyCall);
//
//    cnd.lazyCall = 0;
//}
//
//void mergeNodes(int idx,int left,int right)
//{
//    cnd.sum = (lnd.sum + rnd.sum);
//}
//
//void build(int idx,int st,int ed)
//{
//    if(st == ed)
//    {
//        cnd.zero = 1;
//        cnd.one = 0;
//        cnd.two = 0;
//        cnd.flipCnt = 0;
//        return;
//    }
//    int left = idx*2;
//    int right = left+1;
//    int mid = (st+ed)/2;
//
//    build(callLeft);
//    build(callRight);
//    cnd.zero = (lnd.zero + rnd.zero);
//}
//
//void update(int idx,int st,int ed,int i,int j,int v)
//{
//    if(i > ed || j < st)return;
//    if(st >= i && ed <= j)
//    {
//        updateNode(idx,st,ed,v);
//        return;
//    }
//    int left = idx<<1;
//    int right = left+1;
//    int mid = (st+ed)>>1;
//
//    if(cnd.flipCnt) /// update_lazy
//    {
//        updateLazy(idx,st,ed,i,j);
//    }
//
//    update(callLeft,i,j,v);
//    update(callRight,i,j,v);
//
//    mergeNodes(idx,left,right);
//}
//
//LL query(int idx,int st,int ed,int i,int j)
//{
//    if(i > ed || j < st)return 0;
//    if(st >= i && ed <= j)
//    {
//        return cnd.zero;
//    }
//
//    int left = idx<<1;
//    int right = left+1;
//    int mid = (st+ed)>>1;
//
//    if(cnd.flipCnt)/// update_lazy
//    {
//        updateLazy(idx,st,ed,i,j);
//    }
//    return (query(callLeft,i,j) + query(callRight,i,j));
//}
///// ******************************** Segment Tree Ends *********************************************

vector <int> vec[200]; /// 97 to 97+26

int main()
{
//	ios_base::sync_with_stdio(false);
//    cin.tie(0); /// use "\n" instead of endl
//    READ();
//    WRITE();

    int m;
    cin >> m;
    string s;
    cin >> s;
    set <int> st;
    for(int i=0;i<s.size();i++)
    {
        int x = s[i];
        vec[x].pb(i+1);
//        if(i+1 <= s.size()-m+1)
//        {
            st.insert(i+1);
//        }

    }
    string sAns;
    string sMain = "";
    for(int i=97;i<97+26 && !st.empty();i++)
    {
        if(i > 97)
        {
            for(int j=0;j<vec[i-1].size();j++)
            {
                char c = i-1;
                sMain += c;
            }
        }
        sAns = "";
        for(int j=vec[i].size()-1;j>=0 && !st.empty();j--)
        {
            int id = vec[i][j];
            bool used = false;
            for(int k = id;k>=max(1,id-m+1);k--)
            {
                if(st.find(k) != st.end())
                {
                    st.erase(k);
                    used = true;
                }
//                    break;
            }
            if(used)
            {
                char c = i;
                sAns += c;
//                DBG(sAns);
            }

        }
    }
    cout << sMain+sAns << endl;

//	main();
    return 0;
}


#include <bits/stdc++.h>

using namespace std;

#define READ() 	    freopen("in.txt","r",stdin)
#define WRITE()     freopen("out.txt","w",stdout)
#define sf(n) 	    scanf("%d",&n)
#define sl(x)       scanf("%I64d",&x)
#define lsf(n) 	    scanf("%lld", &n)
#define pb(n) 	    push_back(n)
#define mem(x,y)    memset(x,y,sizeof(x))
#define DBG(x)      cout << #x << " = " << x << endl
#define YOLO        cout << "YOLO" << endl
#define NL			printf("\n")
#define EPS 	    1e-10
#define INF         INT_MAX
#define MAX         INT_MAX
#define MOD         1000000007
#define LL          long long
#define endl        "\n"
#define pi          2.0*acos(0.0)
#define cnd         tree[idx]
#define lnd         tree[left]
#define rnd         tree[right]
#define callLeft    left,st,mid
#define callRight   right,mid+1,ed

///// ******************************** Segment Tree Starts *********************************************
//
//
//struct node
//{
//    LL sum = 0;
//    LL lazyCall = 0;
//
//    node()
//    {
//        sum = 0;
//        lazyCall = 0;
//    }
//};
//
//node tree[4*MAX];
////LL arr[MAX];
//
//void updateNode(int idx,int st,int ed,int v)
//{
//    cnd.sum += v;
//
////    cnd.flipCnt = 0;
//}
//
//void updateLazy(int idx,int st,int ed,int i,int j)
//{
//    int left = idx<<1;
//    int right = left+1;
//    int mid = (st+ed)>>1;
//
//    updateNode(callLeft,cnd.lazyCall);
//    updateNode(callRight,cnd.lazyCall);
//
//    cnd.lazyCall = 0;
//}
//
//void mergeNodes(int idx,int left,int right)
//{
//    cnd.sum = (lnd.sum + rnd.sum);
//}
//
//void build(int idx,int st,int ed)
//{
//    if(st == ed)
//    {
//        cnd.zero = 1;
//        cnd.one = 0;
//        cnd.two = 0;
//        cnd.flipCnt = 0;
//        return;
//    }
//    int left = idx*2;
//    int right = left+1;
//    int mid = (st+ed)/2;
//
//    build(callLeft);
//    build(callRight);
//    cnd.zero = (lnd.zero + rnd.zero);
//}
//
//void update(int idx,int st,int ed,int i,int j,int v)
//{
//    if(i > ed || j < st)return;
//    if(st >= i && ed <= j)
//    {
//        updateNode(idx,st,ed,v);
//        return;
//    }
//    int left = idx<<1;
//    int right = left+1;
//    int mid = (st+ed)>>1;
//
//    if(cnd.flipCnt) /// update_lazy
//    {
//        updateLazy(idx,st,ed,i,j);
//    }
//
//    update(callLeft,i,j,v);
//    update(callRight,i,j,v);
//
//    mergeNodes(idx,left,right);
//}
//
//LL query(int idx,int st,int ed,int i,int j)
//{
//    if(i > ed || j < st)return 0;
//    if(st >= i && ed <= j)
//    {
//        return cnd.zero;
//    }
//
//    int left = idx<<1;
//    int right = left+1;
//    int mid = (st+ed)>>1;
//
//    if(cnd.flipCnt)/// update_lazy
//    {
//        updateLazy(idx,st,ed,i,j);
//    }
//    return (query(callLeft,i,j) + query(callRight,i,j));
//}
///// ******************************** Segment Tree Ends *********************************************

vector <int> vec[200]; /// 97 to 97+26

int main()
{
//	ios_base::sync_with_stdio(false);
//    cin.tie(0); /// use "\n" instead of endl
//    READ();
//    WRITE();

    int m;
    cin >> m;
    string s;
    cin >> s;
    set <int> st;
    for(int i=0;i<s.size();i++)
    {
        int x = s[i];
        vec[x].pb(i+1);
        if(i+1 <= s.size()-m+1)
        {
            st.insert(i+1);
        }

    }
    string sAns = "";
    for(int i=97;i<97+26 && !st.empty();i++)
    {
        for(int j=0;j<vec[i].size() && !st.empty();j++)
        {
            int id = vec[i][j];
            bool used = false;
            for(int k = id;k>=id-m+1;k--)
            {
                if(st.find(k) != st.end())
                {
                    st.erase(k);
                    used = true;
                }
//                    break;
            }
            if(used)
            {
                char c = i;
                sAns += c;
//                DBG(sAns);
            }

        }
    }
    cout << sAns << endl;

//	main();
    return 0;
}


#include <bits/stdc++.h>

using namespace std;

#define READ() 	    freopen("in.txt","r",stdin)
#define WRITE()     freopen("out.txt","w",stdout)
#define sf(n) 	    scanf("%d",&n)
#define sl(x)       scanf("%I64d",&x)
#define lsf(n) 	    scanf("%lld", &n)
#define pb(n) 	    push_back(n)
#define mem(x,y)    memset(x,y,sizeof(x))
#define DBG(x)      cout << #x << " = " << x << endl
#define YOLO        cout << "YOLO" << endl
#define NL			printf("\n")
#define EPS 	    1e-10
#define INF         INT_MAX
#define MAX         INT_MAX
#define MOD         1000000007
#define LL          long long
#define endl        "\n"
#define pi          2.0*acos(0.0)
#define cnd         tree[idx]
#define lnd         tree[left]
#define rnd         tree[right]
#define callLeft    left,st,mid
#define callRight   right,mid+1,ed

///// ******************************** Segment Tree Starts *********************************************
//
//
//struct node
//{
//    LL sum = 0;
//    LL lazyCall = 0;
//
//    node()
//    {
//        sum = 0;
//        lazyCall = 0;
//    }
//};
//
//node tree[4*MAX];
////LL arr[MAX];
//
//void updateNode(int idx,int st,int ed,int v)
//{
//    cnd.sum += v;
//
////    cnd.flipCnt = 0;
//}
//
//void updateLazy(int idx,int st,int ed,int i,int j)
//{
//    int left = idx<<1;
//    int right = left+1;
//    int mid = (st+ed)>>1;
//
//    updateNode(callLeft,cnd.lazyCall);
//    updateNode(callRight,cnd.lazyCall);
//
//    cnd.lazyCall = 0;
//}
//
//void mergeNodes(int idx,int left,int right)
//{
//    cnd.sum = (lnd.sum + rnd.sum);
//}
//
//void build(int idx,int st,int ed)
//{
//    if(st == ed)
//    {
//        cnd.zero = 1;
//        cnd.one = 0;
//        cnd.two = 0;
//        cnd.flipCnt = 0;
//        return;
//    }
//    int left = idx*2;
//    int right = left+1;
//    int mid = (st+ed)/2;
//
//    build(callLeft);
//    build(callRight);
//    cnd.zero = (lnd.zero + rnd.zero);
//}
//
//void update(int idx,int st,int ed,int i,int j,int v)
//{
//    if(i > ed || j < st)return;
//    if(st >= i && ed <= j)
//    {
//        updateNode(idx,st,ed,v);
//        return;
//    }
//    int left = idx<<1;
//    int right = left+1;
//    int mid = (st+ed)>>1;
//
//    if(cnd.flipCnt) /// update_lazy
//    {
//        updateLazy(idx,st,ed,i,j);
//    }
//
//    update(callLeft,i,j,v);
//    update(callRight,i,j,v);
//
//    mergeNodes(idx,left,right);
//}
//
//LL query(int idx,int st,int ed,int i,int j)
//{
//    if(i > ed || j < st)return 0;
//    if(st >= i && ed <= j)
//    {
//        return cnd.zero;
//    }
//
//    int left = idx<<1;
//    int right = left+1;
//    int mid = (st+ed)>>1;
//
//    if(cnd.flipCnt)/// update_lazy
//    {
//        updateLazy(idx,st,ed,i,j);
//    }
//    return (query(callLeft,i,j) + query(callRight,i,j));
//}
///// ******************************** Segment Tree Ends *********************************************

vector <int> vec[200]; /// 97 to 97+26

int main()
{
//	ios_base::sync_with_stdio(false);
//    cin.tie(0); /// use "\n" instead of endl
//    READ();
//    WRITE();

    int m;
    cin >> m;
    string s;
    cin >> s;
    set <int> st;
    for(int i=0;i<s.size();i++)
    {
        int x = s[i];
        vec[x].pb(i+1);
        if(i+1 <= s.size()-m+1)
        {
            st.insert(i+1);
        }

    }
    string sAns;
    string sMain = "";
    for(int i=97;i<97+26 && !st.empty();i++)
    {
        if(i > 97)
        {
            for(int j=0;j<vec[i-1].size();j++)
            {
                char c = i-1;
                sMain += c;
            }
        }
        sAns = "";
        for(int j=vec[i].size()-1;j>=0 && !st.empty();j--)
        {
            int id = vec[i][j];
            bool used = false;
            for(int k = id;k>=max(1,id-m+1);k--)
            {
                if(st.find(k) != st.end())
                {
                    st.erase(k);
                    used = true;
                }
//                    break;
            }
            if(used)
            {
                char c = i;
                sAns += c;
//                DBG(sAns);
            }

        }
    }
    cout << sMain+sAns << endl;

//	main();
    return 0;
}


#include <bits/stdc++.h>

using namespace std;

#define READ() 	    freopen("in.txt","r",stdin)
#define WRITE()     freopen("out.txt","w",stdout)
#define sf(n) 	    scanf("%d",&n)
#define sl(x)       scanf("%I64d",&x)
#define lsf(n) 	    scanf("%lld", &n)
#define pb(n) 	    push_back(n)
#define mem(x,y)    memset(x,y,sizeof(x))
#define DBG(x)      cout << #x << " = " << x << endl
#define YOLO        cout << "YOLO" << endl
#define NL			printf("\n")
#define EPS 	    1e-10
#define INF         INT_MAX
#define MAX         INT_MAX
#define MOD         1000000007
#define LL          long long
#define endl        "\n"
#define pi          2.0*acos(0.0)
#define cnd         tree[idx]
#define lnd         tree[left]
#define rnd         tree[right]
#define callLeft    left,st,mid
#define callRight   right,mid+1,ed

///// ******************************** Segment Tree Starts *********************************************
//
//
//struct node
//{
//    LL sum = 0;
//    LL lazyCall = 0;
//
//    node()
//    {
//        sum = 0;
//        lazyCall = 0;
//    }
//};
//
//node tree[4*MAX];
////LL arr[MAX];
//
//void updateNode(int idx,int st,int ed,int v)
//{
//    cnd.sum += v;
//
////    cnd.flipCnt = 0;
//}
//
//void updateLazy(int idx,int st,int ed,int i,int j)
//{
//    int left = idx<<1;
//    int right = left+1;
//    int mid = (st+ed)>>1;
//
//    updateNode(callLeft,cnd.lazyCall);
//    updateNode(callRight,cnd.lazyCall);
//
//    cnd.lazyCall = 0;
//}
//
//void mergeNodes(int idx,int left,int right)
//{
//    cnd.sum = (lnd.sum + rnd.sum);
//}
//
//void build(int idx,int st,int ed)
//{
//    if(st == ed)
//    {
//        cnd.zero = 1;
//        cnd.one = 0;
//        cnd.two = 0;
//        cnd.flipCnt = 0;
//        return;
//    }
//    int left = idx*2;
//    int right = left+1;
//    int mid = (st+ed)/2;
//
//    build(callLeft);
//    build(callRight);
//    cnd.zero = (lnd.zero + rnd.zero);
//}
//
//void update(int idx,int st,int ed,int i,int j,int v)
//{
//    if(i > ed || j < st)return;
//    if(st >= i && ed <= j)
//    {
//        updateNode(idx,st,ed,v);
//        return;
//    }
//    int left = idx<<1;
//    int right = left+1;
//    int mid = (st+ed)>>1;
//
//    if(cnd.flipCnt) /// update_lazy
//    {
//        updateLazy(idx,st,ed,i,j);
//    }
//
//    update(callLeft,i,j,v);
//    update(callRight,i,j,v);
//
//    mergeNodes(idx,left,right);
//}
//
//LL query(int idx,int st,int ed,int i,int j)
//{
//    if(i > ed || j < st)return 0;
//    if(st >= i && ed <= j)
//    {
//        return cnd.zero;
//    }
//
//    int left = idx<<1;
//    int right = left+1;
//    int mid = (st+ed)>>1;
//
//    if(cnd.flipCnt)/// update_lazy
//    {
//        updateLazy(idx,st,ed,i,j);
//    }
//    return (query(callLeft,i,j) + query(callRight,i,j));
//}
///// ******************************** Segment Tree Ends *********************************************

vector <int> vec[200]; /// 97 to 97+26

int main()
{
//	ios_base::sync_with_stdio(false);
//    cin.tie(0); /// use "\n" instead of endl
//    READ();
//    WRITE();

    int m;
    cin >> m;
    string s;
    cin >> s;
    set <int> st;
    for(int i=0;i<s.size();i++)
    {
        int x = s[i];
        vec[x].pb(i+1);
        if(i+1 <= s.size()-m+1)
        {
            st.insert(i+1);
        }

    }
    string sAns = "";
    for(int i=97;i<97+26 && !st.empty();i++)
    {
        for(int j=vec[i].size()-1;j>=0 && !st.empty();j--)
        {
            int id = vec[i][j];
            bool used = false;
            for(int k = id;k>=max(1,id-m+1);k--)
            {
                if(st.find(k) != st.end())
                {
                    st.erase(k);
                    used = true;
                }
//                    break;
            }
            if(used)
            {
                char c = i;
                sAns += c;
//                DBG(sAns);
            }

        }
    }
    cout << sAns << endl;

//	main();
    return 0;
}


#include <bits/stdc++.h>

using namespace std;

#define READ() 	    freopen("in.txt","r",stdin)
#define WRITE()     freopen("out.txt","w",stdout)
#define sf(n) 	    scanf("%d",&n)
#define sl(x)       scanf("%I64d",&x)
#define lsf(n) 	    scanf("%lld", &n)
#define pb(n) 	    push_back(n)
#define mem(x,y)    memset(x,y,sizeof(x))
#define DBG(x)      cout << #x << " = " << x << endl
#define YOLO        cout << "YOLO" << endl
#define NL			printf("\n")
#define EPS 	    1e-10
#define INF         INT_MAX
#define MAX         100010
#define MOD         1000000007
#define LL          long long
#define endl        "\n"
#define pi          2.0*acos(0.0)
#define cnd         tree[idx]
#define lnd         tree[left]
#define rnd         tree[right]
#define callLeft    left,st,mid
#define callRight   right,mid+1,ed

vector <int> vec[200];

int segID = 0;
int segX[MAX];
int segY[MAX];

int taken[MAX];

int freq[200];

bool visited[MAX];

int main()
{
//	ios_base::sync_with_stdio(false);
//    cin.tie(0); /// use "\n" instead of endl
//    READ();
//    WRITE();
    mem(taken,0);
    mem(freq,0);
    mem(visited,false);
    int m;
    cin >> m;
    string s;
    cin >> s;
    int len = s.size();
//    set <int> st;
    for(int i=0;i<len;i++)
    {
        int x = s[i];
        freq[x]++;
        vec[x].pb(i);

        if(i+m-1 < len)
        {
//            st.insert(i); /// i to i+m-1
            segX[segID] = i;
            segY[segID] = i+m-1;
            segID++;
        }
    }

    int mxI = 0;
    for(int i=97;i<97+26;i++)
    {
        if(vec[i].size() > 0)
        {
            int savePrvFoundID = -1;
            for(int j=0;j<segID;j++)
            {
                int x = segX[j];
                int y = segY[j];
                if(savePrvFoundID != -1 && savePrvFoundID >= x && savePrvFoundID <= y)
                {
                    if(!visited[x])
                    {
                        visited[x] = true;
                        mxI = max(mxI,i);
                    }
                }
                else if(!visited[x])
                {
                    int idY = lower_bound(vec[i].begin(),vec[i].end(),y) - vec[i].begin();
                    if(vec[i][idY] != y)idY--;
                    if(vec[i][idY] >= x && vec[i][idY] <= y && idY >= 0)
                    {
                        visited[x] = true;
                        taken[vec[i][idY]] = 1;
                        mxI = max(mxI,i);
                        savePrvFoundID = vec[i][idY];
                    }
                }
            }
        }
    }

//    for(int i=0;i<len;i++)
//    {
//        DBG(i);
//        DBG(taken[i]);
//        NL;
//    }

    for(int i=97;i<mxI;i++)
    {
        for(int j=0;j<freq[i];j++)
        {
            char c = i;
            cout << c;
        }
    }
//    YOLO;
    for(int i=0;i<len;i++)
    {
        int x = s[i];
        if(x == mxI && taken[i] == 1)cout << s[i];
    }
//    YOLO;
    cout << endl;

//	main();
    return 0;
}


#include <bits/stdc++.h>
using namespace std;

#define _p(...) (void)printf(__VA_ARGS__)
#define forr(x,arr) for(auto&& x:arr)
#define _overload3(_1,_2,_3,name,...) name
#define _rep2(i,n) _rep3(i,0,n)
#define _rep3(i,a,b) for(int i=int(a);i<int(b);++i)
#define rep(...) _overload3(__VA_ARGS__,_rep3,_rep2,)(__VA_ARGS__)
#define _rrep2(i,n) _rrep3(i,0,n)
#define _rrep3(i,a,b) for(int i=int(b)-1;i>=int(a);i--)
#define rrep(...) _overload3(__VA_ARGS__,_rrep3,_rrep2,)(__VA_ARGS__)
#define ALL(x) (x).begin(), (x).end()
#define BIT(n) (1LL<<(n))
#define SZ(x) ((int)(x).size())
#define fst first
#define snd second
using ll=long long;using pii=pair<int,int>;using vb=vector<bool>;
using vi=vector<int>;using vvi=vector<vi>;using vvvi=vector<vvi>;
using vl=vector<ll>;using vvl=vector<vl>;using vvvl=vector<vvl>;
using vd=vector<double>;using vvd=vector<vd>;using vvvd=vector<vvd>;
using vpii=vector<pii>;using vvpii=vector<vpii>;using vvvpii=vector<vvpii>;
template <typename T> T read() {T t; cin >> t; return t;}

template<class V, class Merge> struct SegmentTree {
  const int n;
  vector<V> val;
  const V unit_value;

  SegmentTree(int _n) : n(1 << (33-__builtin_clz(_n-1))), val(n), unit_value(Merge::unit()) {}

  V get(int i) const { return val[i + n / 2]; }
  void set(int i, const V &v) { val[i + n / 2] = v; }

  void build() {
    for (int i = n / 2 - 1; i > 0; i--) val[i] = Merge::merge(val[i * 2 + 0], val[i * 2 + 1]);
  }

  void update(int i, const V &v) {
    i += n / 2;
    val[i] = v;
    while (i > 1) {
      i >>= 1;
      val[i] = Merge::merge(val[i * 2 + 0], val[i * 2 + 1]);
    }
  }

  // [l, r)
  V query(int l, int r) const {
    l = max(0, min(n / 2, l));
    r = max(0, min(n / 2, r));
    V ret = unit_value;
    for (; l < r; l >>= 1, r >>= 1) {
      if (l & 1) ret = Merge::merge(ret, val[l++]);
      if (r & 1) ret = Merge::merge(ret, val[--r]);
    }
    return ret;
  }
};
template <class V> struct MergeRangeMinQ {
  static V merge(const V &l, const V &r) { return l < r ? l : r; }
  static V unit() { return make_pair('z', 10000000); }
};

void Main() {
  int m = read<int>();
  string s = read<string>();
  int n = SZ(s);

  SegmentTree<pair<char, int>, MergeRangeMinQ<pair<char, int>>> seg(n+m+10);
  rep(i, n) seg.set(i, {s[i], -i});
  seg.build();

  char ma = 'a';
  rep(i, n-m+1) {
    char mi = seg.query(i, i+m).fst;
    ma = max(ma, mi);
  }

  //cout<<"ma: "<<ma<<endl;

  string ans;
  int las = -1;
  rep(i, n) {
    char c = s[i];
    if (c < ma) {
      ans += c;
      las = i;
    }
    else if (las + m == i) {
      pair<char, int> mii = seg.query(i+1-m, i+1);
      ans += ma;
      las = -mii.snd;
    }
  }
  sort(ALL(ans));
  cout << ans << endl;
}
int main() { cin.tie(nullptr); ios::sync_with_stdio(false); Main(); return 0; }


#include <bits/stdc++.h>
using namespace std;

#define _p(...) (void)printf(__VA_ARGS__)
#define forr(x,arr) for(auto&& x:arr)
#define _overload3(_1,_2,_3,name,...) name
#define _rep2(i,n) _rep3(i,0,n)
#define _rep3(i,a,b) for(int i=int(a);i<int(b);++i)
#define rep(...) _overload3(__VA_ARGS__,_rep3,_rep2,)(__VA_ARGS__)
#define _rrep2(i,n) _rrep3(i,0,n)
#define _rrep3(i,a,b) for(int i=int(b)-1;i>=int(a);i--)
#define rrep(...) _overload3(__VA_ARGS__,_rrep3,_rrep2,)(__VA_ARGS__)
#define ALL(x) (x).begin(), (x).end()
#define BIT(n) (1LL<<(n))
#define SZ(x) ((int)(x).size())
#define fst first
#define snd second
using ll=long long;using pii=pair<int,int>;using vb=vector<bool>;
using vi=vector<int>;using vvi=vector<vi>;using vvvi=vector<vvi>;
using vl=vector<ll>;using vvl=vector<vl>;using vvvl=vector<vvl>;
using vd=vector<double>;using vvd=vector<vd>;using vvvd=vector<vvd>;
using vpii=vector<pii>;using vvpii=vector<vpii>;using vvvpii=vector<vvpii>;
template <typename T> T read() {T t; cin >> t; return t;}

template<class V, class Merge> struct SegmentTree {
  const int n;
  vector<V> val;
  const V unit_value;

  SegmentTree(int _n) : n(1 << (33-__builtin_clz(_n-1))), val(n), unit_value(Merge::unit()) {}

  void update(int i, const V &v) {
    i += n / 2;
    val[i] = v;
    while (i > 1) {
      i >>= 1;
      val[i] = Merge::merge(val[i * 2 + 0], val[i * 2 + 1]);
    }
  }

  V get(int i) const {
    return val[i + n / 2];
  }

  // [l, r)
  V query(int l, int r) const {
    l += n / 2;
    r += n / 2;
    V ret = unit_value;
    for (; l < r; l >>= 1, r >>= 1) {
      if (l & 1) ret = Merge::merge(ret, val[l++]);
      if (r & 1) ret = Merge::merge(ret, val[--r]);
    }
    return ret;
  }
};
template <class V> struct MergeRangeMinQ {
  static V merge(const V &l, const V &r) { return l < r ? l : r; }
  static V unit() { return make_pair('z', 10000000); }
};

void Main() {
  int m = read<int>();
  string s = read<string>();
  int n = SZ(s);

  SegmentTree<pair<char, int>, MergeRangeMinQ<pair<char, int>>> seg(n+m+10);
  rep(i,n) seg.update(i, {s[i], -i});

  char ma = 'a';
  rep(i, n-m+1) {
    char mi = seg.query(i, i+m).fst;
    ma = max(ma, mi);
  }

  //cout<<"ma: "<<ma<<endl;

  string ans;
  int las = -1;
  rep(i, n) {
    char c = s[i];
    if (c < ma) {
      ans += c;
      las = i;
    }
    else if (las + m == i) {
      pair<char, int> mii = seg.query(i+1-m, i+1);
      ans += ma;
      las = -mii.snd;
    }
  }
  sort(ALL(ans));
  cout << ans << endl;
}
int main() { cin.tie(nullptr); ios::sync_with_stdio(false); Main(); return 0; }


#include <bits/stdc++.h>
using namespace std;

#define _p(...) (void)printf(__VA_ARGS__)
#define forr(x,arr) for(auto&& x:arr)
#define _overload3(_1,_2,_3,name,...) name
#define _rep2(i,n) _rep3(i,0,n)
#define _rep3(i,a,b) for(int i=int(a);i<int(b);++i)
#define rep(...) _overload3(__VA_ARGS__,_rep3,_rep2,)(__VA_ARGS__)
#define _rrep2(i,n) _rrep3(i,0,n)
#define _rrep3(i,a,b) for(int i=int(b)-1;i>=int(a);i--)
#define rrep(...) _overload3(__VA_ARGS__,_rrep3,_rrep2,)(__VA_ARGS__)
#define ALL(x) (x).begin(), (x).end()
#define BIT(n) (1LL<<(n))
#define SZ(x) ((int)(x).size())
#define fst first
#define snd second
using ll=long long;using pii=pair<int,int>;using vb=vector<bool>;
using vi=vector<int>;using vvi=vector<vi>;using vvvi=vector<vvi>;
using vl=vector<ll>;using vvl=vector<vl>;using vvvl=vector<vvl>;
using vd=vector<double>;using vvd=vector<vd>;using vvvd=vector<vvd>;
using vpii=vector<pii>;using vvpii=vector<vpii>;using vvvpii=vector<vvpii>;
template <typename T> T read() {T t; cin >> t; return t;}

template<class V> struct SegTree0 {
  const int n;
  vector<V> val;

  SegTree0(int _n): n(p2(_n)), val(n * 2, def) {}
  void reinit() {
    val.fill(def);
  }
  V getval(int a, int b) {
    return getval(a, b, 0, 0, n);
  }
  void update(int i, V v) {
    i += n - 1;
    val[i] = v;
    while (i > 0) {
      i = (i - 1) / 2;
      val[i] = comp(val[i * 2 + 1], val[i * 2 + 2]);
    }
  }
  private:
  V getval(int a, int b, int k, int l, int r) {
    if (r <= a || b <= l) return def;
    if (a <= l && r <= b) return val[k];
    return comp(getval(a, b, k * 2 + 1, l, (l + r) / 2), getval(a, b, k * 2 + 2, (l + r) / 2, r));
  }
  static int p2(int n, int m=1) { return m >= n ? m : p2(n, m * 2); }
  V comp(const V& l, const V& r) { return min(l, r);};
  const V def = make_pair('z', 10000000);
};

void Main() {
  int m = read<int>();
  string s = read<string>();
  int n = SZ(s);

  SegTree0<pair<char, int>> seg(n+m+10);
  rep(i,n) seg.update(i, {s[i], -i});

  char ma = 'a';
  rep(i, n-m+1) {
    char mi = seg.getval(i, i+m).fst;
    ma = max(ma, mi);
  }

  //cout<<"ma: "<<ma<<endl;

  string ans;
  int las = -1;
  rep(i, n) {
    char c = s[i];
    if (c < ma) {
      ans += c;
      las = i;
    }
    else if (las + m == i) {
      pair<char, int> mii = seg.getval(i+1-m, i+1);
      ans += ma;
      las = mii.snd;
    }
  }
  sort(ALL(ans));
  cout << ans << endl;
}
int main() { cin.tie(nullptr); ios::sync_with_stdio(false); Main(); return 0; }


#include <bits/stdc++.h>
using namespace std;

#define _p(...) (void)printf(__VA_ARGS__)
#define forr(x,arr) for(auto&& x:arr)
#define _overload3(_1,_2,_3,name,...) name
#define _rep2(i,n) _rep3(i,0,n)
#define _rep3(i,a,b) for(int i=int(a);i<int(b);++i)
#define rep(...) _overload3(__VA_ARGS__,_rep3,_rep2,)(__VA_ARGS__)
#define _rrep2(i,n) _rrep3(i,0,n)
#define _rrep3(i,a,b) for(int i=int(b)-1;i>=int(a);i--)
#define rrep(...) _overload3(__VA_ARGS__,_rrep3,_rrep2,)(__VA_ARGS__)
#define ALL(x) (x).begin(), (x).end()
#define BIT(n) (1LL<<(n))
#define SZ(x) ((int)(x).size())
#define fst first
#define snd second
using ll=long long;using pii=pair<int,int>;using vb=vector<bool>;
using vi=vector<int>;using vvi=vector<vi>;using vvvi=vector<vvi>;
using vl=vector<ll>;using vvl=vector<vl>;using vvvl=vector<vvl>;
using vd=vector<double>;using vvd=vector<vd>;using vvvd=vector<vvd>;
using vpii=vector<pii>;using vvpii=vector<vpii>;using vvvpii=vector<vvpii>;
template <typename T> T read() {T t; cin >> t; return t;}

template<class V, class Merge> struct SegmentTree {
  const int n;
  vector<V> val;
  const V unit_value;

  SegmentTree(int _n) : n(1 << (33-__builtin_clz(_n-1))), val(n), unit_value(Merge::unit()) {}

  V get(int i) const { return val[i + n / 2]; }
  void set(int i, const V &v) { val[i + n / 2] = v; }

  void build() {
    for (int i = n / 2 - 1; i > 0; i--) val[i] = Merge::merge(val[i * 2 + 0], val[i * 2 + 1]);
  }

  void update(int i, const V &v) {
    i += n / 2;
    val[i] = v;
    while (i > 1) {
      i >>= 1;
      val[i] = Merge::merge(val[i * 2 + 0], val[i * 2 + 1]);
    }
  }

  // [l, r)
  V query(int l, int r) const {
    l = max(0, min(n / 2, l)) + n / 2;
    r = max(0, min(n / 2, r)) + n / 2;
    V ret = unit_value;
    for (; l < r; l >>= 1, r >>= 1) {
      if (l & 1) ret = Merge::merge(ret, val[l++]);
      if (r & 1) ret = Merge::merge(ret, val[--r]);
    }
    return ret;
  }
};
template <class V> struct MergeRangeMinQ {
  static V merge(const V &l, const V &r) { return l < r ? l : r; }
  static V unit() { return make_pair('z', 10000000); }
};

void Main() {
  int m = read<int>();
  string s = read<string>();
  int n = SZ(s);

  SegmentTree<pair<char, int>, MergeRangeMinQ<pair<char, int>>> seg(n+m+10);
  rep(i, n) seg.set(i, {s[i], -i});
  seg.build();

  char ma = 'a';
  rep(i, n-m+1) {
    char mi = seg.query(i, i+m).fst;
    ma = max(ma, mi);
  }

  //cout<<"ma: "<<ma<<endl;

  string ans;
  int las = -1;
  rep(i, n) {
    char c = s[i];
    if (c < ma) {
      ans += c;
      las = i;
    }
    else if (las + m == i) {
      pair<char, int> mii = seg.query(i+1-m, i+1);
      ans += ma;
      las = -mii.snd;
    }
  }
  sort(ALL(ans));
  cout << ans << endl;
}
int main() { cin.tie(nullptr); ios::sync_with_stdio(false); Main(); return 0; }


#include <bits/stdc++.h>
using namespace std;

#define _p(...) (void)printf(__VA_ARGS__)
#define forr(x,arr) for(auto&& x:arr)
#define _overload3(_1,_2,_3,name,...) name
#define _rep2(i,n) _rep3(i,0,n)
#define _rep3(i,a,b) for(int i=int(a);i<int(b);++i)
#define rep(...) _overload3(__VA_ARGS__,_rep3,_rep2,)(__VA_ARGS__)
#define _rrep2(i,n) _rrep3(i,0,n)
#define _rrep3(i,a,b) for(int i=int(b)-1;i>=int(a);i--)
#define rrep(...) _overload3(__VA_ARGS__,_rrep3,_rrep2,)(__VA_ARGS__)
#define ALL(x) (x).begin(), (x).end()
#define BIT(n) (1LL<<(n))
#define SZ(x) ((int)(x).size())
#define fst first
#define snd second
using ll=long long;using pii=pair<int,int>;using vb=vector<bool>;
using vi=vector<int>;using vvi=vector<vi>;using vvvi=vector<vvi>;
using vl=vector<ll>;using vvl=vector<vl>;using vvvl=vector<vvl>;
using vd=vector<double>;using vvd=vector<vd>;using vvvd=vector<vvd>;
using vpii=vector<pii>;using vvpii=vector<vpii>;using vvvpii=vector<vvpii>;
template <typename T> T read() {T t; cin >> t; return t;}

template<class V> struct SegTree0 {
  const int n;
  vector<V> val;

  SegTree0(int _n): n(p2(_n)), val(n * 2, def) {}
  void reinit() {
    val.fill(def);
  }
  V getval(int a, int b) {
    return getval(a, b, 0, 0, n);
  }
  void update(int i, V v) {
    i += n - 1;
    val[i] = v;
    while (i > 0) {
      i = (i - 1) / 2;
      val[i] = comp(val[i * 2 + 1], val[i * 2 + 2]);
    }
  }
  private:
  V getval(int a, int b, int k, int l, int r) {
    if (r <= a || b <= l) return def;
    if (a <= l && r <= b) return val[k];
    return comp(getval(a, b, k * 2 + 1, l, (l + r) / 2), getval(a, b, k * 2 + 2, (l + r) / 2, r));
  }
  static int p2(int n, int m=1) { return m >= n ? m : p2(n, m * 2); }
  V comp(const V& l, const V& r) { return min(l, r);};
  const V def = make_pair('z', 10000000);
};

void Main() {
  int m = read<int>();
  string s = read<string>();
  int n = SZ(s);

  SegTree0<pair<char, int>> seg(n+m+10);
  rep(i,n) seg.update(i, {s[i], -i});

  char ma = 'a';
  rep(i, n-m+1) {
    char mi = seg.getval(i, i+m).fst;
    ma = max(ma, mi);
  }

  //cout<<"ma: "<<ma<<endl;

  string ans;
  int las = -1;
  rep(i, n) {
    char c = s[i];
    if (c < ma) {
      ans += c;
      las = i;
    }
    else if (las + m == i) {
      pair<char, int> mii = seg.getval(i+1-m, i+1);
      ans += ma;
      las = -mii.snd;
    }
  }
  sort(ALL(ans));
  cout << ans << endl;
}
int main() { cin.tie(nullptr); ios::sync_with_stdio(false); Main(); return 0; }


#include <bits/stdc++.h>
using namespace std;

#define _p(...) (void)printf(__VA_ARGS__)
#define forr(x,arr) for(auto&& x:arr)
#define _overload3(_1,_2,_3,name,...) name
#define _rep2(i,n) _rep3(i,0,n)
#define _rep3(i,a,b) for(int i=int(a);i<int(b);++i)
#define rep(...) _overload3(__VA_ARGS__,_rep3,_rep2,)(__VA_ARGS__)
#define _rrep2(i,n) _rrep3(i,0,n)
#define _rrep3(i,a,b) for(int i=int(b)-1;i>=int(a);i--)
#define rrep(...) _overload3(__VA_ARGS__,_rrep3,_rrep2,)(__VA_ARGS__)
#define ALL(x) (x).begin(), (x).end()
#define BIT(n) (1LL<<(n))
#define SZ(x) ((int)(x).size())
#define fst first
#define snd second
using ll=long long;using pii=pair<int,int>;using vb=vector<bool>;
using vi=vector<int>;using vvi=vector<vi>;using vvvi=vector<vvi>;
using vl=vector<ll>;using vvl=vector<vl>;using vvvl=vector<vvl>;
using vd=vector<double>;using vvd=vector<vd>;using vvvd=vector<vvd>;
using vpii=vector<pii>;using vvpii=vector<vpii>;using vvvpii=vector<vvpii>;
template <typename T> T read() {T t; cin >> t; return t;}

template<class V, class Merge> struct SegmentTree {
  const int n;
  vector<V> val;
  const V unit_value;

  SegmentTree(int _n) : n(1 << (33-__builtin_clz(_n-1))), val(n), unit_value(Merge::unit()) {}

  V get(int i) const { return val[i + n / 2]; }
  void set(int i, const V &v) { val[i + n / 2] = v; }

  void build() {
    for (int i = n / 2 - 1; i > 0; i--) val[i] = Merge::merge(val[i * 2 + 0], val[i * 2 + 1]);
  }

  void update(int i, const V &v) {
    i += n / 2;
    val[i] = v;
    while (i > 1) {
      i >>= 1;
      val[i] = Merge::merge(val[i * 2 + 0], val[i * 2 + 1]);
    }
  }

  // [l, r)
  V query(int l, int r) const {
    l += n / 2;
    r += n / 2;
    V ret = unit_value;
    for (; l < r; l >>= 1, r >>= 1) {
      if (l & 1) ret = Merge::merge(ret, val[l++]);
      if (r & 1) ret = Merge::merge(ret, val[--r]);
    }
    return ret;
  }
};
template <class V> struct MergeRangeMinQ {
  static V merge(const V &l, const V &r) { return l < r ? l : r; }
  static V unit() { return make_pair('z', 10000000); }
};

void Main() {
  int m = read<int>();
  string s = read<string>();
  int n = SZ(s);

  SegmentTree<pair<char, int>, MergeRangeMinQ<pair<char, int>>> seg(n+m+10);
  rep(i, n) seg.set(i, {s[i], -i});
  seg.build();

  char ma = 'a';
  rep(i, n-m+1) {
    char mi = seg.query(i, i+m).fst;
    ma = max(ma, mi);
  }

  //cout<<"ma: "<<ma<<endl;

  string ans;
  int las = -1;
  rep(i, n) {
    char c = s[i];
    if (c < ma) {
      ans += c;
      las = i;
    }
    else if (las + m == i) {
      pair<char, int> mii = seg.query(i+1-m, i+1);
      ans += ma;
      las = -mii.snd;
    }
  }
  sort(ALL(ans));
  cout << ans << endl;
}
int main() { cin.tie(nullptr); ios::sync_with_stdio(false); Main(); return 0; }


//coded by dsingh_24
#include<bits/stdc++.h>
#define ll          long long
#define pb          push_back
#define mp          make_pair
#define pll         pair<long long,long long>
#define vll          vector<long long>
#define all(a)      (a).begin(),(a).end()
#define F           first
#define S           second
#define sz(x)       (long long)x.size()
#define hell        1000000007
#define lbnd        lower_bound
#define ubnd        upper_bound
#define bs          binary_search
#define ios         ios_base::sync_with_stdio(false);cin.tie(0);cout.tie(0);
using namespace std;
vector<char>ans;
ll v[100005];
int main()
{
	ios
    ll n,i,j,ctr=0,now=0,tt=0;
    cin>>n;
    string s;
    char mx='a',in;
    cin>>s;
    ll t=s.size();
    while(now+n-1<t)
    {
    //	ll m=now;
    	in=s[now+1];
    	for(i=now;i<=now+n-1;i++)
    	{
    		if(s[i]<=in)
    		{
    			in=s[i];tt=i;
			}
		}
		now=tt+1;mx=max(mx,in);ans.pb(in);v[tt]=1;tt++;
	//	cout<<now<<endl;
	}
	for(i=0;i<t;i++)
	if(s[i]<mx&&!v[i])ans.pb(s[i]);
	sort(all(ans));
	for(i=0;i<ans.size();i++)cout<<ans[i];
	return 0;
}


//coded by dsingh_24
#include<bits/stdc++.h>
#define ll          long long
#define pb          push_back
#define mp          make_pair
#define pll         pair<long long,long long>
#define vll          vector<long long>
#define all(a)      (a).begin(),(a).end()
#define F           first
#define S           second
#define sz(x)       (long long)x.size()
#define hell        1000000007
#define lbnd        lower_bound
#define ubnd        upper_bound
#define bs          binary_search
#define ios         ios_base::sync_with_stdio(false);cin.tie(0);cout.tie(0);
using namespace std;
vector<char>ans;
ll v[100005];
int main()
{
	ios
    ll n,i,j,ctr=0,now=0,tt=0;
    cin>>n;
    string s;
    char mx='a',in;
    cin>>s;
    while(now+n-1<s.size())
    {
    	ll m=now;
    	in=s[now+1];
    	for(i=now;i<=now+n-1;i++)
    	{
    		if(s[i]<=in)
    		{
    			in=s[i];tt=i;
			}
		}
		now=tt+1;mx=max(mx,in);ans.pb(in);v[tt]=1;
	//	cout<<now<<endl;
	}
	for(i=0;i<s.size();i++)
	if(s[i]<mx&&!v[i])ans.pb(s[i]);
	sort(all(ans));
	for(i=0;i<ans.size();i++)cout<<ans[i];
	return 0;
}


//coded by dsingh_24
#include<bits/stdc++.h>
#define ll          long long
#define pb          push_back
#define mp          make_pair
#define pll         pair<long long,long long>
#define vll          vector<long long>
#define all(a)      (a).begin(),(a).end()
#define F           first
#define S           second
#define sz(x)       (long long)x.size()
#define hell        1000000007
#define lbnd        lower_bound
#define ubnd        upper_bound
#define bs          binary_search
#define ios         ios_base::sync_with_stdio(false);cin.tie(0);cout.tie(0);
using namespace std;
vector<char>ans;
ll v[100005];
int main()
{
	ios
    ll n,i,j,ctr=0,now=0,tt=0;
    cin>>n;
    string s;
    char mx='a',in;
    cin>>s;
    ll t=s.size();
    while(now+n-1<t)
    {
    //	ll m=now;
    	in=s[now];tt=now;
    	for(i=now;i<=now+n-1;i++)
    	{
    		if(s[i]<=in)
    		{
    			in=s[i];tt=i;
			}
		}
		now=tt+1;mx=max(mx,in);ans.pb(in);v[tt]=1;tt++;
	//	cout<<now<<endl;
	}
	for(i=0;i<t;i++)
	if(s[i]<mx&&!v[i])ans.pb(s[i]);
	sort(all(ans));
	for(i=0;i<ans.size();i++)cout<<ans[i];
	return 0;
}


//coded by dsingh_24
#include<bits/stdc++.h>
#define ll          long long
#define pb          push_back
#define mp          make_pair
#define pll         pair<long long,long long>
#define vll          vector<long long>
#define all(a)      (a).begin(),(a).end()
#define F           first
#define S           second
#define sz(x)       (long long)x.size()
#define hell        1000000007
#define lbnd        lower_bound
#define ubnd        upper_bound
#define bs          binary_search
#define ios         ios_base::sync_with_stdio(false);cin.tie(0);cout.tie(0);
using namespace std;
vector<char>ans;
ll v[100005];
int main()
{
	ios
    ll n,i,j,ctr=0,now=0,tt=0;
    cin>>n;
    string s;
    char mx='a',in;
    cin>>s;
    while(now+n-1<s.size())
    {
    //	ll m=now;
    	in=s[now+1];
    	for(i=now;i<=now+n-1;i++)
    	{
    		if(s[i]<=in)
    		{
    			in=s[i];tt=i;
			}
		}
		now=tt+1;mx=max(mx,in);ans.pb(in);v[tt]=1;
	//	cout<<now<<endl;
	}
	for(i=0;i<s.size();i++)
	if(s[i]<mx&&!v[i])ans.pb(s[i]);
	sort(all(ans));
	for(i=0;i<ans.size();i++)cout<<ans[i];
	return 0;
}


#include <cstdio>
#include <iostream>
#include <vector>
#include <algorithm>
#include <functional>
#include <set>
#include <map>
#include <string>
#include <queue>
#include <stack>
#include <cstring>
#include <iterator>
#include <cmath>
#include <unordered_set>
#include <unordered_map>
#include <bitset>
#include <chrono>

#pragma comment(linker, "/stack:200000000")
//#pragma GCC optimize("Ofast")
#pragma GCC target("sse,sse2,sse3,ssse3,sse4,popcnt,abm,mmx,avx,tune=native")
#pragma GCC optimize("unroll-loops")

using namespace std;
typedef int mt;

template<typename T>
constexpr mt infValue = std::is_same<T, int>::value ? 2000100007 : 8600000000000000007ll;
template<typename T>
constexpr mt maxValue = std::is_same<T, int>::value ? 1000000007 : 1000000000000000001ll;

#define rep(a, b, i) for(register mt i = a; i < b; ++i)
#define repe(a, b, i) for(register mt i = a; i <= b; ++i)
#define repd(a, b, i) for(register mt i = a; i > b; --i)
#define repde(a, b, i) for(register mt i = a; i >= b; --i)

const mt INF = infValue<mt>;
const long long MOD = 1000000007ll;
const double EPS = 1e-6;
const mt MAX = maxValue<mt>;

#define N 100101
#define K 64
#define P 18
#define M (2000111)

typedef pair<mt, mt> pr;
mt n, m;
char s[N];
set<pr> s0;
vector<mt> p[26];
mt dp[2][N];
multiset<mt> ms;
int main(void)
{
#ifdef _DEBUG
	freopen("in.txt", "r", stdin);
#endif
	scanf("%d", &m);
	scanf("%s", s);
	while (s[n]) p[s[n] - 'a'].push_back(n), ++n;
	if(n > m) s0.insert({0, n - 1});
	rep(0, 26, i) {
		if (s0.empty()) break;
		if (p[i].empty()) continue;

		rep(0, p[i].size(), j) {
			mt l = 0, r = 0;
			auto sp = s0.upper_bound({ p[i][j], INF });
			if (sp == s0.begin()) continue;
			--sp;

			l = sp->first, r = p[i][j] - 1;
			if (r - l + 1 >= m) s0.insert({ l, r });

			l = p[i][j] + 1, r = sp->second;
			if (r - l + 1 >= m) s0.insert({ l, r });

			s0.erase(sp);
		}

		if (s0.empty()) {
			rep(0, n, j) {
				dp[0][j] = (j > 0 ? *ms.begin(): 0);
				dp[1][j] = (j - m >= 0 ? dp[0][j - m]: 0) + 1;
				if (s[j] < i + '0') dp[0][j] = dp[1][j] = min(dp[0][j], (j - m + 1 >= 0 ? dp[0][j - m + 1] : 0));
				if (s[j] == i + '0') dp[0][j] = dp[1][j] = min(dp[0][j], (j - m + 1 >= 0 ? dp[0][j - m + 1] : 0) + 1);

				ms.insert(dp[1][j]);
				if(j - m + 1 >= 0) ms.erase(ms.lower_bound(dp[1][j - m + 1]));
			}
			mt cnt = dp[0][n - 1];
			while (cnt--) putc('a' + i, stdout);
			break;
		}
		else {
			mt cnt = p[i].size();
			while (cnt--) putc('a' + i, stdout);
		}
	}
	putc('\n', stdout);

	return 0;
}


#include <cstdio>
#include <iostream>
#include <vector>
#include <algorithm>
#include <functional>
#include <set>
#include <map>
#include <string>
#include <queue>
#include <stack>
#include <cstring>
#include <iterator>
#include <cmath>
#include <unordered_set>
#include <unordered_map>
#include <bitset>
#include <chrono>

#pragma comment(linker, "/stack:200000000")
//#pragma GCC optimize("Ofast")
#pragma GCC target("sse,sse2,sse3,ssse3,sse4,popcnt,abm,mmx,avx,tune=native")
#pragma GCC optimize("unroll-loops")

using namespace std;
typedef int mt;

template<typename T>
constexpr mt infValue = std::is_same<T, int>::value ? 2000100007 : 8600000000000000007ll;
template<typename T>
constexpr mt maxValue = std::is_same<T, int>::value ? 1000000007 : 1000000000000000001ll;

#define rep(a, b, i) for(register mt i = a; i < b; ++i)
#define repe(a, b, i) for(register mt i = a; i <= b; ++i)
#define repd(a, b, i) for(register mt i = a; i > b; --i)
#define repde(a, b, i) for(register mt i = a; i >= b; --i)

const mt INF = infValue<mt>;
const long long MOD = 1000000007ll;
const double EPS = 1e-6;
const mt MAX = maxValue<mt>;

#define N 100101
#define K 64
#define P 18
#define M (2000111)

mt n, m;
char s[N];
vector<mt> p[26];
mt dp[2][N];
multiset<mt> ms;

bool f(mt i) {
	bool ok = true;
	mt l = -1;
	rep(0, n, j) {
		ok = ok && (j - l + 1 <= m);
		if (s[j] <= 'a' + i) l = j;
	}
	return ok;
}
mt bs() {//ff up
	mt l = -1, r = 25;
	while (r - l > 1) {
		mt md = l + r >> 1;
		if (f(md)) r = md;
		else l = md;
	}
	return r;
}

int main(void)
{
#ifdef _DEBUG
	freopen("in.txt", "r", stdin);
#endif
	scanf("%d", &m);
	scanf("%s", s);
	while (s[n]) p[s[n] - 'a'].push_back(n), ++n;
	//rep(0, 26, i) {
	{
		mt i = bs();
		rep(0, i, j) {
			mt cnt = p[j].size();
			while (cnt--) putc('a' + j, stdout);
		}

		mt cnt = p[i].size();
		if (m > 1) {
			rep(0, n, j) {
				dp[0][j] = (j >= m ? *ms.begin() : 0);
				dp[1][j] = INF;//(j - m >= 0 ? dp[0][j - m]: 0) + 1;
				if (s[j] < i + 'a') dp[1][j] = min(dp[1][j], (j - m >= 0 ? dp[1][j - m] : 0));
				if (s[j] == i + 'a') dp[1][j] = min(dp[1][j], (j - m >= 0 ? dp[0][j - m] : 0) + 1);
				dp[0][j] = min(dp[0][j], dp[1][j]);

				ms.insert(dp[1][j]);
				if (j - m + 1 >= 0) ms.erase(ms.lower_bound(dp[1][j - m + 1]));
			}
			cnt = dp[0][n - 1];
		}

		while (cnt--) putc('a' + i, stdout);
	}
	putc('\n', stdout);

	return 0;
}


#include <cstdio>
#include <iostream>
#include <vector>
#include <algorithm>
#include <functional>
#include <set>
#include <map>
#include <string>
#include <queue>
#include <stack>
#include <cstring>
#include <iterator>
#include <cmath>
#include <unordered_set>
#include <unordered_map>
#include <bitset>
#include <chrono>

#pragma comment(linker, "/stack:200000000")
//#pragma GCC optimize("Ofast")
#pragma GCC target("sse,sse2,sse3,ssse3,sse4,popcnt,abm,mmx,avx,tune=native")
#pragma GCC optimize("unroll-loops")

using namespace std;
typedef int mt;

template<typename T>
constexpr mt infValue = std::is_same<T, int>::value ? 2000100007 : 8600000000000000007ll;
template<typename T>
constexpr mt maxValue = std::is_same<T, int>::value ? 1000000007 : 1000000000000000001ll;

#define rep(a, b, i) for(register mt i = a; i < b; ++i)
#define repe(a, b, i) for(register mt i = a; i <= b; ++i)
#define repd(a, b, i) for(register mt i = a; i > b; --i)
#define repde(a, b, i) for(register mt i = a; i >= b; --i)

const mt INF = infValue<mt>;
const long long MOD = 1000000007ll;
const double EPS = 1e-6;
const mt MAX = maxValue<mt>;

#define N 100101
#define K 64
#define P 18
#define M (2000111)

mt n, m, cnt;
char s[N];
vector<mt> p[26];

mt dp[2][N];

bool f(mt i) {
	bool ok = true;
	mt l = 0;
	rep(0, n, j) {
		if (s[j] <= 'a' + i) l = j;
		ok = ok && (j - l + 1 <= m);
	}
	return ok;
}
mt bs() {//ff up
	mt l = -1, r = 25;
	while (r - l > 1) {
		mt md = l + r >> 1;
		if (f(md)) r = md;
		else l = md;
	}
	return r;
}

multiset<mt> bv;
int main(void)
{
#ifdef _DEBUG
	freopen("in.txt", "r", stdin);
#endif
	scanf("%d", &m);
	scanf("%s", s);
	while (s[n]) p[s[n] - 'a'].push_back(n), ++n;
	if (m > 1) {
		mt k = bs();
		rep(0, k, j) {
			mt cnt = p[j].size();
			while (cnt--) putc('a' + j, stdout);
		}

		dp[0][0] = 0;
		if (s[0] < 'a' + k) {
			dp[1][0] = 0;
		}
		else if (s[0] == 'a' + k) {
			dp[1][0] = 1;
		}
		else {
			dp[1][0] = INF;
		}
		bv.insert(dp[1][0]);
		//cnt = p[k].size();

		rep(1, n, i) {
			mt j = max(i - m + 1, 0), mm = *bv.begin();//INF;
			/*rep(j, i, di)
				mm = min(mm, dp[1][di]);*/
			mt mmm = i - m < 0 ? 0 : min(mm, dp[1][i - m]);

			if (s[i] < 'a' + k) {
				dp[0][i] = dp[1][i] = mmm;
			}
			else if (s[i] == 'a' + k) {
				dp[0][i] = mmm;
				dp[1][i] = mmm + 1;
			}
			else {
				dp[0][i] = mm;
				dp[1][i] = INF;
			}

			if (i - m + 1 >= 0) bv.erase(bv.lower_bound(dp[1][i - m + 1]));
			bv.insert(dp[1][i]);
		}
		cnt = dp[0][n - 1];
		while (cnt--) putc('a' + k, stdout);
		putc('\n', stdout);
	}
	else {
		sort(s, s + n);
		puts(s);
	}

	return 0;
}


#include <cstdio>
#include <iostream>
#include <vector>
#include <algorithm>
#include <functional>
#include <set>
#include <map>
#include <string>
#include <queue>
#include <stack>
#include <cstring>
#include <iterator>
#include <cmath>
#include <unordered_set>
#include <unordered_map>
#include <bitset>
#include <chrono>

#pragma comment(linker, "/stack:200000000")
//#pragma GCC optimize("Ofast")
#pragma GCC target("sse,sse2,sse3,ssse3,sse4,popcnt,abm,mmx,avx,tune=native")
#pragma GCC optimize("unroll-loops")

using namespace std;
typedef int mt;

template<typename T>
constexpr mt infValue = std::is_same<T, int>::value ? 2000100007 : 8600000000000000007ll;
template<typename T>
constexpr mt maxValue = std::is_same<T, int>::value ? 1000000007 : 1000000000000000001ll;

#define rep(a, b, i) for(register mt i = a; i < b; ++i)
#define repe(a, b, i) for(register mt i = a; i <= b; ++i)
#define repd(a, b, i) for(register mt i = a; i > b; --i)
#define repde(a, b, i) for(register mt i = a; i >= b; --i)

const mt INF = infValue<mt>;
const long long MOD = 1000000007ll;
const double EPS = 1e-6;
const mt MAX = maxValue<mt>;

#define N 100101
#define K 64
#define P 18
#define M (2000111)

mt n, m, cnt;
char s[N];
vector<mt> p[26];

mt dp[2][N];

bool f(mt i) {
	bool ok = true;
	mt l = 0;
	rep(0, n, j) {
		if (s[j] <= 'a' + i) l = j;
		ok = ok && (j - l + 1 <= m);
	}
	return ok;
}
mt bs() {//ff up
	mt l = -1, r = 25;
	while (r - l > 1) {
		mt md = l + r >> 1;
		if (f(md)) r = md;
		else l = md;
	}
	return r;
}

multiset<mt> bv;
int main(void)
{
#ifdef _DEBUG
	freopen("in.txt", "r", stdin);
#endif
	scanf("%d", &m);
	scanf("%s", s);
	while (s[n]) p[s[n] - 'a'].push_back(n), ++n;
	mt k = bs();
	rep(0, k, j) {
		mt cnt = p[j].size();
		while (cnt--) putc('a' + j, stdout);
	}

	dp[0][0] = 0;
	if (s[0] < 'a' + k) {
		dp[1][0] = 0;
	}
	else if (s[0] == 'a' + k) {
		dp[1][0] = 1;
	}
	else {
		dp[1][0] = INF;
	}
	bv.insert(dp[1][0]);
	cnt = p[k].size();
	if (m > 1) {
		rep(1, n, i) {
			mt j = max(i - m + 1, 0), mm = *bv.begin();//INF;
			/*rep(j, i, di)
				mm = min(mm, dp[1][di]);*/
			mt mmm = i - m < 0 ? 0 : min(mm, dp[1][i - m]);

			if (s[i] < 'a' + k) {
				dp[0][i] = dp[1][i] = mmm;
			}
			else if (s[i] == 'a' + k) {
				dp[0][i] = mmm;
				dp[1][i] = mmm + 1;
			}
			else {
				dp[0][i] = mm;
				dp[1][i] = INF;
			}

			if (i - m + 1 >= 0) bv.erase(bv.lower_bound(dp[1][i - m + 1]));
			bv.insert(dp[1][i]);
		}
		cnt = dp[0][n - 1];
	}
	while (cnt--) putc('a' + k, stdout);
	putc('\n', stdout);

	return 0;
}


#include <cstdio>
#include <iostream>
#include <vector>
#include <algorithm>
#include <functional>
#include <set>
#include <map>
#include <string>
#include <queue>
#include <stack>
#include <cstring>
#include <iterator>
#include <cmath>
#include <unordered_set>
#include <unordered_map>
#include <bitset>
#include <chrono>

#pragma comment(linker, "/stack:200000000")
//#pragma GCC optimize("Ofast")
#pragma GCC target("sse,sse2,sse3,ssse3,sse4,popcnt,abm,mmx,avx,tune=native")
#pragma GCC optimize("unroll-loops")

using namespace std;
typedef int mt;

template<typename T>
constexpr mt infValue = std::is_same<T, int>::value ? 2000100007 : 8600000000000000007ll;
template<typename T>
constexpr mt maxValue = std::is_same<T, int>::value ? 1000000007 : 1000000000000000001ll;

#define rep(a, b, i) for(register mt i = a; i < b; ++i)
#define repe(a, b, i) for(register mt i = a; i <= b; ++i)
#define repd(a, b, i) for(register mt i = a; i > b; --i)
#define repde(a, b, i) for(register mt i = a; i >= b; --i)

const mt INF = infValue<mt>;
const long long MOD = 1000000007ll;
const double EPS = 1e-6;
const mt MAX = maxValue<mt>;

#define N 100101
#define K 64
#define P 18
#define M (2000111)

mt n, m;
bool ok;
char s[N];
set<mt> s0;
vector<mt> p[26];
mt dp[2][N];
multiset<mt> ms;
int main(void)
{
#ifdef _DEBUG
	freopen("in.txt", "r", stdin);
#endif
	scanf("%d", &m);
	scanf("%s", s);
	while (s[n]) p[s[n] - 'a'].push_back(n), ++n;
	if(n <= m) ok = true;
	rep(0, 26, i) {
		if (ok) break;
		if (p[i].empty()) continue;

		ok = true;
		rep(0, p[i].size(), j) s0.insert(p[i][j]);
		rep(0, p[i].size(), j) {
			auto ps = s0.lower_bound(p[i][j]);
			if (ps != s0.begin()) {
				auto pp = ps; --pp;
				ok = ok && (p[i][j] - *pp) <= m;
			}
			else {
				ok = ok && (p[i][j] - 0) <= m;
			}

			{
				auto pp = ps; ++pp;
				if (pp != s0.end()) ok = ok && (*pp - p[i][j]) <= m;
				else ok = ok && (n - 1 - p[i][j]) <= m;
			}
		}

		if (ok) {
			mt cnt = p[i].size();
			if (m > 1) {
				rep(0, n, j) {
					dp[0][j] = (j >= m ? *ms.begin() : 0);
					dp[1][j] = INF;//(j - m >= 0 ? dp[0][j - m]: 0) + 1;
					if (s[j] < i + 'a') dp[1][j] = min(dp[1][j], (j - m >= 0 ? dp[1][j - m] : 0));
					if (s[j] == i + 'a') dp[1][j] = min(dp[1][j], (j - m >= 0 ? dp[0][j - m] : 0) + 1);
					dp[0][j] = min(dp[0][j], dp[1][j]);

					ms.insert(dp[1][j]);
					if (j - m + 1 >= 0) ms.erase(ms.lower_bound(dp[1][j - m + 1]));
				}
				cnt = dp[0][n - 1];
			}

			while (cnt--) putc('a' + i, stdout);
			break;
		}
		else {
			mt cnt = p[i].size();
			while (cnt--) putc('a' + i, stdout);
		}
	}
	putc('\n', stdout);

	return 0;
}