#include <stdio.h>
#include <stdlib.h>
#include <iostream>
#include <string.h>
#include <algorithm>
#include <math.h>
#include <vector>
#include <queue>
#include <set>
#include <stack>
#include <map>
#define INF_MAX 2147483647
#define INF_MIN -2147483647
#define INF_LL 9223372036854775807LL
#define INF 2000000000
#define PI acos(-1.0)
#define inf INT_MAX
#define llu unsigned long long int
#define all(v) v.begin(),v.end()
#define pb push_back
#define mp make_pair
#define F first
#define si(n) scanf("%d",&n)
#define slli(n) scanf("%lld",&n);
#define ss(n) scanf("%s",n);
#define trace1(x) cerr << #x << " is " << x << endl;
#define trace2(x , y) cerr << #x << " is " << x << "  " << #y << " is " << y << endl;
using namespace std;
typedef long long int LL;

int BIT[2000010] , len;

void update(int index , int val){
	while(index < 1000000){
		BIT[index]+=val;
		index+=(index&(-index));
	}
}

int query(int index){
	int ret = 0;
	while(index > 0){
		ret = ret + BIT[index];
		index-=(index&(-index));
	}
	return ret;
}

int q2(int x , int y){
	return query(y) - query(x-1);
}

std::vector<int > indexes[30];
int window;

int nextOne(int curr)
{
	int st , en , ans = -1 , md , x;
	st = curr + 1;
	en = len;
	x = query(curr);
	while(st <= en)
	{
		md = st + (en - st)/2;
		if(query(md) == x)
			st = md + 1;
		else{
			ans = md;
			en = md - 1;
		}
	}
	if(ans != -1)
		return ans;
	return len + 1;
}

int prevOne(int curr)
{
	int st , en , md , x , ans = -1;
	st = 1;
	en = curr - 1;
	x = query(curr);

	while(st <= en)
	{
		md = st + (en - st)/2;
		// trace2(md , curr);

		// trace1(q2(md , curr));
		if(q2(md , curr)!=0)
		{
			ans = md;
			st = md + 1;
		}
		else
			en = md - 1;
	}
	if(ans!=-1)
		return ans;
	return 0;
}

int main()
{
si(window);
string ip;
cin >> ip;
len = ip.length();
ip = "#" + ip;

for(int i=1;i<=len;i++)
{
	indexes[ip[i] - 'a' + 1].pb(i);
}

string ans = "";
int x , y , curr , nxt , prv;
char c;
int used[30];
memset(used , 0 , sizeof(used));

for(int i=1;i<=26;i++)
{
	for(int j=0;j<indexes[i].size();j++)
	{
		curr = indexes[i][j];
		nxt = nextOne(curr);
		prv = prevOne(curr);
		if( (nxt - prv) >= (window + 1) )
		{
			c = i + 'a' - 1;
			ans = ans + c;
			update(curr , 1);
			used[i]++;
		}
	}
}

for(int j=2;j<=26;j++)
{
	if(used[j] > 0)
	{
		for(int k=used[j-1];k<indexes[j-1].size();k++)
		{
			c = j - 1 - 1 + 'a';
			ans = ans + c ;
		}
	}
}

sort(ans.begin() , ans.end());

cout << ans << endl;
return 0;
}


#include<iostream>
#include<map>
#include<vector>
#include<algorithm>

using namespace std;

string a, b = "";
int m, r = 0, k[26], ll[26];
int ar[26];

int main()
{
    cin >> m;
    cin >> a;
    for (int i = 0; i < m; i++)
    {
        ar[a[i] - 97]++;
        ll[a[i] - 97] = i;
        k[a[i] - 97] = -1;
    }

    for (int i = 0; i <= a.length() - m; i++)
    {
        for (int j = 0; j < 26; j++)
        {
            if (ar[j] != 0)
            {
                if (k[j] < i)
                {
                    b = b + char(97 + j);
                    k[j] = ll[j];
                }
                break;
            }
        }
        ar[a[i] - 97]--;
        if (i != a.length() - m)
        {
            ar[a[i + m] - 97]++;
            ll[a[i + m] - 97] = i + m;
        }
    }

    sort(b.begin(), b.end());
    string h = "";
    for (int i = 0; i < a.length(); i++)
        if (a[i] < b[b.length() - 1])
            h += a[i];

    for (int i = b.length() - 1; i >= 0; i--)
    {
        if (b[i] != b[b.length() - 1])
            break;
        h += b[i];
    }
    sort(h.begin(), h.end());
    cout << h;
    return 0;
}


#include<iostream>
#include<map>
#include<vector>
#include<algorithm>

using namespace std;

string a, b = "";
int m, r = 0, k = -1;
int ar[26];

int main()
{
    cin >> m;
    cin >> a;
    for (int i = 0; i < m; i++)
        ar[a[i] - 97]++;

    for (int i = 0; i < a.length() - m; i++)
    {
        for (int j = 0; j < 26; j++)
        {
            if (ar[j] != 0)
            {
                if (k != j)
                {
                    b = b + char(97 + j);
                }
                k = j;
                break;
            }
        }
        ar[a[i] - 97]--;
        ar[a[i + m] - 97]++;
    }

    sort(b.begin(), b.end());
    string h = "";
    for (int i = 0; i < a.length(); i++)
        if (a[i] < b[b.length() - 1])
            h += a[i];

    for (int i = b.length() - 1; i >= 0; i--)
    {
        if (b[i] != b[b.length() - 1])
            break;
        h += b[i];
    }
    sort(h.begin(), h.end());
    cout << h;
    return 0;
}


#include<iostream>
#include<map>
#include<vector>
#include<algorithm>

using namespace std;

string a, b = "";
int m, r = 0, k[26], ll[26];
int ar[26];

int main()
{
    cin >> m;
    cin >> a;
    for (int i = 0; i < m; i++)
    {
        ar[a[i] - 97]++;
        ll[a[i] - 97] = i;
        k[a[i] - 97] = -1;
    }

    for (int i = 0; i <= a.length() - m; i++)
    {
        for (int j = 0; j < 26; j++)
        {
            if (ar[j] != 0)
            {
                if (k[j] < i)
                {
                    b = b + char(97 + j);
                    k[j] = ll[j];
                }
                break;
            }
        }
        ar[a[i] - 97]--;
        if (i != a.length() - m)
        {
            ar[a[i + m] - 97]++;
            ll[a[i + m] - 97] = i;
        }
    }

    sort(b.begin(), b.end());
    string h = "";
    for (int i = 0; i < a.length(); i++)
        if (a[i] < b[b.length() - 1])
            h += a[i];

    for (int i = b.length() - 1; i >= 0; i--)
    {
        if (b[i] != b[b.length() - 1])
            break;
        h += b[i];
    }
    sort(h.begin(), h.end());
    cout << h;
    return 0;
}


#include<iostream>
#include<map>
#include<vector>
#include<algorithm>

using namespace std;

string a, b = "";
int m, r = 0, k = -1;
int ar[26];

int main()
{
    cin >> m;
    cin >> a;
    for (int i = 0; i < m; i++)
        ar[a[i] - 97]++;

    for (int i = 0; i <= a.length() - m; i++)
    {
        for (int j = 0; j < 26; j++)
        {
            if (ar[j] != 0)
            {
                if (k != j)
                {
                    b = b + char(97 + j);
                }
                k = j;
                break;
            }
        }
        ar[a[i] - 97]--;
        if (i != a.length() - m)
        ar[a[i + m] - 97]++;
    }

    sort(b.begin(), b.end());
    string h = "";
    for (int i = 0; i < a.length(); i++)
        if (a[i] < b[b.length() - 1])
            h += a[i];

    for (int i = b.length() - 1; i >= 0; i--)
    {
        if (b[i] != b[b.length() - 1])
            break;
        h += b[i];
    }
    sort(h.begin(), h.end());
    cout << h;
    return 0;
}


#include<iostream>
#include<map>
#include<vector>
#include<algorithm>

using namespace std;

string a, b = "";
int m, r = 0, k[26], ll[26];
int ar[26];

int main()
{
    cin >> m;
    cin >> a;
    for (int i = 0; i < m; i++)
    {
        ar[a[i] - 97]++;
        ll[a[i] - 97] = i;
        k[a[i] - 97] = -1;
    }

    for (int i = 0; i <= a.length() - m; i++)
    {
        for (int j = 0; j < 26; j++)
        {
            if (ar[j] != 0)
            {
                if (k[j] < i)
                {
                    b = b + char(97 + j);
                }else
                {
                    k[j] = ll[j];
                }
                break;
            }
        }
        ar[a[i] - 97]--;
        if (i != a.length() - m)
        {
            ar[a[i + m] - 97]++;
            ll[a[i + m] - 97] = i;
        }
    }

    sort(b.begin(), b.end());
    string h = "";
    for (int i = 0; i < a.length(); i++)
        if (a[i] < b[b.length() - 1])
            h += a[i];

    for (int i = b.length() - 1; i >= 0; i--)
    {
        if (b[i] != b[b.length() - 1])
            break;
        h += b[i];
    }
    sort(h.begin(), h.end());
    cout << h;
    return 0;
}


#include <bits/stdc++.h>
#define maxn 300
#define Task ""
#define fx(i, a, b) for (int i = (a); i <= (b); i++)
#define fn(i, a, b) for (int i = (a); i >= (b); i--)
#define vti vector <int>
#define Pb push_back
#define pii pair <int, int>
#define mp make_pair
#define F first
#define S second
#define mod 1000000007

using namespace std;
int m, val[maxn];
string s;

int main()
{
    //freopen (Task".inp", "r", stdin);
    //freopen (Task".out", "w", stdout);
    cin >> m >> s;
    int n = s.length();
    s = ' ' + s;
    char mx = 'z';
    fx(i, 1, n-m+1)
    {
        char u = 'z';
        int p = 0;
        fx(j, i, i + m -1)
            if (s[j] <= u)
            {
                u = s[j];
                p = j;
            }
        if (!p)continue;
        val[u]++;
        s[p] = '.';
        if(mx > u) mx = u;
        i = p;
    }
    fx(i, 1, n)
    if(s[i] == '.' && s[i] < mx) val[s[i]]++;
    fx(i, 97, 97 + 25)
    while (val[i]--) printf("%c", i);
    return 0;
}


#include <bits/stdc++.h>
#define maxn 300
#define Task ""
#define fx(i, a, b) for (int i = (a); i <= (b); i++)
#define fn(i, a, b) for (int i = (a); i >= (b); i--)
#define vti vector <int>
#define Pb push_back
#define pii pair <int, int>
#define mp make_pair
#define F first
#define S second
#define mod 1000000007

using namespace std;
int m, val[maxn];
string s;

int main()
{
    //freopen (Task".inp", "r", stdin);
    //freopen (Task".out", "w", stdout);
    cin >> m >> s;
    int n = s.length();
    s = ' ' + s;
    char mx = 'a';
    fx(i, 1, n-m+1)
    {
        char u = 'z';
        int p = 0;
        fx(j, i, i + m -1)
            if (s[j] <= u)
            {
                u = s[j];
                p = j;
            }
        if (!p)continue;
        val[u]++;
        s[p] = '.';
        if(mx < u) mx = u;
        i = p;
    }

    fx(i, 1, n)
    if(s[i] != '.' && s[i] < mx)
        val[s[i]]++;
    fx(i, 97, 97 + 25)
    while (val[i]--) printf("%c", i);
    return 0;
}


#include <bits/stdc++.h>
#define maxn 300
#define Task ""
#define fx(i, a, b) for (int i = (a); i <= (b); i++)
#define fn(i, a, b) for (int i = (a); i >= (b); i--)
#define vti vector <int>
#define Pb push_back
#define pii pair <int, int>
#define mp make_pair
#define F first
#define S second
#define mod 1000000007

using namespace std;
int m, val[maxn];
string s;

int main()
{
    //freopen (Task".inp", "r", stdin);
    //freopen (Task".out", "w", stdout);
    cin >> m >> s;
    int n = s.length();
    s = ' ' + s;
    char mx = 'z';
    fx(i, 1, n-m+1)
    {
        char u = 'z';
        int p = 0;
        fx(j, i, i + m -1)
            if (s[j] <= u)
            {
                u = s[j];
                p = j;
            }
        if (!p)continue;
        val[u]++;
        s[p] = '.';
        if(mx < u) mx = u;
        i = p;
    }
    fx(i, 1, n)
    if(s[i] == '.' && s[i] < mx) val[s[i]]++;
    fx(i, 97, 97 + 25)
    while (val[i]--) printf("%c", i);
    return 0;
}


#include <bits/stdc++.h>
#define maxn 300
#define Task ""
#define fx(i, a, b) for (int i = (a); i <= (b); i++)
#define fn(i, a, b) for (int i = (a); i >= (b); i--)
#define vti vector <int>
#define Pb push_back
#define pii pair <int, int>
#define mp make_pair
#define F first
#define S second
#define mod 1000000007

using namespace std;
int m, val[maxn];
string s;

int main()
{
    //freopen (Task".inp", "r", stdin);
    //freopen (Task".out", "w", stdout);
    cin >> m >> s;
    int n = s.length();
    s = ' ' + s;
    char mx = 'a';
    fx(i, 1, n-m+1)
    {
        char u = 'z';
        int p = 0;
        fx(j, i, i + m -1)
            if (s[j] <= u)
            {
                u = s[j];
                p = j;
            }
        if (!p)continue;
        val[u]++;
        s[p] = '.';
        if(mx > u) mx = u;
        i = p;
    }

    fx(i, 1, n)
    if(s[i] != '.' && s[i] <= mx)
        val[s[i]]++;
    fx(i, 97, 97 + 25)
    while (val[i]--) printf("%c", i);
    return 0;
}


#include <iostream>
#include <cstdio>
#include <cstdlib>
#include <cstring>
#include <cmath>
#include <string>
#include <map>
#include <vector>
#include <set>
#include <queue>
#include <algorithm>

using namespace std;

typedef long long 	LL;
typedef pair <int, int> 	PII;
typedef vector <int> 	VI;

#define FOR(i, x, y) 	for(int i = x; i < y; ++ i)
#define IFOR(i, x, y) 	for(int i = x; i > y; -- i)
#define pb	push_back
#define mp 	make_pair
#define fi 	first
#define se 	second
#define lrt rt<<1
#define rrt rt<<1|1
#define lson rt<<1, l, mid
#define rson rt<<1|1, mid+1, r

const int maxn = 100010;

int n, m;
char str[maxn];

int sum[26], id[26];
VI	ans;
char s1[maxn], s2[maxn];

void work() {
	memset(sum, 0, sizeof(sum));
	FOR(i, 0, 26) 	id[i] = n;
	int r = n-1, l = n-m;
	FOR(i, l, n) {
		++ sum[str[i]-'a'];
		id[str[i]-'a'] = i;
	}
	ans.clear();
	bool flag = true;
	int sss = 0;
	while(true) {
		int nr = r;
		FOR(i, 0, 26) if(sum[i]){
			if(r-l+1 < m) {
			    flag = false;
			    sss = i;
			    break;
            }
			ans.pb(i);
			nr = id[i];
			break;
		}
		if(!flag)   break;
		-- nr;
		if(nr < 0) 	break;
		int nl = max(nr-m+1, 0);
		while(r > nr) {
			-- sum[str[r]-'a'];
			-- r;
		}
		r = nr;
		while(l > nl) {
			-- l;
			++ sum[str[l]-'a'];
			id[str[l]-'a'] = l;
		}
		l = nl;
	}
	sort(ans.begin(), ans.end());
	FOR(i, 0, (int)ans.size()) {
		s1[i] = ans[i]+'a';
	}
	s1[(int)ans.size()] = '\0';
	if(flag) 	printf("%s\n", s1);
	else 	{
		ans.pb(sss);
		sort(ans.begin(), ans.end());
		FOR(i, 0, (int)ans.size()) {
			s2[i] = ans[i]+'a';
		}
		s2[(int)ans.size()] = '\0';
		if(strcmp(s1, s2) > 0) 	printf("%s\n", s2);
		else	printf("%s\n", s1);
	}
}

int main() {
    //freopen("test.in","r",stdin);
	while(~scanf("%d", &m)) {
		scanf("%s", str);
		n = strlen(str);
		work();
	}
	return 0;
}


#include <iostream>
#include <cstdio>
#include <cstdlib>
#include <cstring>
#include <cmath>
#include <string>
#include <map>
#include <vector>
#include <set>
#include <queue>
#include <algorithm>

using namespace std;

typedef long long 	LL;
typedef pair <int, int> 	PII;
typedef vector <int> 	VI;

#define FOR(i, x, y) 	for(int i = x; i < y; ++ i)
#define IFOR(i, x, y) 	for(int i = x; i > y; -- i)
#define pb	push_back
#define mp 	make_pair
#define fi 	first
#define se 	second
#define lrt rt<<1
#define rrt rt<<1|1
#define lson rt<<1, l, mid
#define rson rt<<1|1, mid+1, r

const int maxn = 100010;

set <pair<char, int> > s;
vector <char> ans;

char str[maxn];
int n, m;
int sum[26];

int main() {
	while(~scanf("%d", &m)) {
		ans.clear();
		s.clear();
		memset(sum, 0, sizeof(sum));
		scanf("%s", str);
		n = strlen(str);
		int mx = -1;
		IFOR(i, n-1, -1) {
			++ sum[str[i]-'a'];
			s.insert(mp(str[i], i));
			if((int)s.size() < m) continue;
			set<pair<char, int> > :: iterator
				it = s.begin();
			/*
			printf("%d %d %c\n", i, it->se, it->fi);
			*/
			-- sum[it->fi-'a'];
			mx = max(it->fi-'a', mx);
			ans.pb(it->fi);
			FOR(j, it->se, i+m)
				s.erase(mp(str[j], j));
		}
		FOR(i, 0, mx) {
			while(sum[i]) {
				ans.pb(i+'a');
				-- sum[i];
			}
		}
		sort(ans.begin(), ans.end());
		FOR(i, 0, ans.size()) printf("%c", ans[i]);
		printf("\n");
	}
	return 0;
}


#include <iostream>
#include <cstdio>
#include <cstdlib>
#include <cstring>
#include <cmath>
#include <string>
#include <map>
#include <vector>
#include <set>
#include <queue>
#include <algorithm>

using namespace std;

typedef long long 	LL;
typedef pair <int, int> 	PII;
typedef vector <int> 	VI;

#define FOR(i, x, y) 	for(int i = x; i < y; ++ i)
#define IFOR(i, x, y) 	for(int i = x; i > y; -- i)
#define pb	push_back
#define mp 	make_pair
#define fi 	first
#define se 	second
#define lrt rt<<1
#define rrt rt<<1|1
#define lson rt<<1, l, mid
#define rson rt<<1|1, mid+1, r

const int maxn = 100010;

int n, m;
char str[maxn];

int sum[26], id[26];
VI	ans;
char s1[maxn], s2[maxn];

void work() {
	memset(sum, 0, sizeof(sum));
	FOR(i, 0, 26) 	id[i] = n;
	int r = n-1, l = n-m;
	IFOR(i, r, l-1) {
		++ sum[str[i]-'a'];
		id[str[i]-'a'] = i;
	}
	ans.clear();
	bool flag = true;
	int sss = 0;
	while(true) {
		int nr = r;
		FOR(i, 0, 26) if(sum[i]){
			if(r-l+1 < m) {
			    flag = false;
			    sss = i;
			    break;
            }
			ans.pb(i);
			nr = id[i];
			break;
		}
		if(!flag)   break;
		-- nr;
		if(nr < 0) 	break;
		int nl = max(nr-m+1, 0);
		while(r > nr) {
			-- sum[str[r]-'a'];
			-- r;
		}
		r = nr;
		while(l > nl) {
			-- l;
			++ sum[str[l]-'a'];
			id[str[l]-'a'] = l;
		}
		l = nl;
	}
	sort(ans.begin(), ans.end());
	FOR(i, 0, (int)ans.size()) {
		s1[i] = ans[i]+'a';
	}
	s1[(int)ans.size()] = '\0';
	if(flag) 	printf("%s\n", s1);
	else 	{
		ans.pb(sss);
		sort(ans.begin(), ans.end());
		FOR(i, 0, (int)ans.size()) {
			s2[i] = ans[i]+'a';
		}
		s2[(int)ans.size()] = '\0';
		if(strcmp(s1, s2) > 0) 	printf("%s\n", s2);
		else	printf("%s\n", s1);
	}
}

int main() {
    //freopen("test.in","r",stdin);
	while(~scanf("%d", &m)) {
		scanf("%s", str);
		n = strlen(str);
		work();
	}
	return 0;
}


#include <iostream>
#include <cstdio>
#include <cstdlib>
#include <cstring>
#include <cmath>
#include <string>
#include <map>
#include <vector>
#include <set>
#include <queue>
#include <algorithm>

using namespace std;

typedef long long 	LL;
typedef pair <int, int> 	PII;
typedef vector <int> 	VI;

#define FOR(i, x, y) 	for(int i = x; i < y; ++ i)
#define IFOR(i, x, y) 	for(int i = x; i > y; -- i)
#define pb	push_back
#define mp 	make_pair
#define fi 	first
#define se 	second
#define lrt rt<<1
#define rrt rt<<1|1
#define lson rt<<1, l, mid
#define rson rt<<1|1, mid+1, r

const int maxn = 100010;

int n, m;
char str[maxn];

int sum[26], id[26];
VI	ans;
char s1[maxn], s2[maxn];

void work() {
	memset(sum, 0, sizeof(sum));
	FOR(i, 0, 26) 	id[i] = n;
	int r = n-1, l = n-m;
	FOR(i, l, n) {
		++ sum[str[i]-'a'];
		id[str[i]-'a'] = i;
	}
	ans.clear();
	bool flag = true;
	int sss = 0;
	while(true) {
		int nr = r;
		FOR(i, 0, 26) if(sum[i]){
			if(r-l+1 < m) {flag = false; sss = i;break;}
			ans.pb(i);
			nr = id[i];
			break;
		}
		if(!flag)   break;
		-- nr;
		if(nr < 0) 	break;
		int nl = max(nr-m+1, 0);
		while(r > nr) {
			-- sum[str[r]-'a'];
			-- r;
		}
		r = nr;
		while(l > nl) {
			-- l;
			++ sum[str[l]-'a'];
			id[str[l]-'a'] = l;
		}
		l = nl;
	}
	sort(ans.begin(), ans.end());
	FOR(i, 0, (int)ans.size()) {
		s1[i] = ans[i]+'a';
	}
	s1[(int)ans.size()] = '\0';
	if(!flag) 	printf("%s\n", s1);
	else 	{
		ans.pb(sss);
		sort(ans.begin(), ans.end());
		FOR(i, 0, (int)ans.size()) {
			s2[i] = ans[i]+'a';
		}
		s2[(int)ans.size()] = '\0';
		if(strcmp(s1, s2) > 0) 	printf("%s\n", s2);
		else	printf("%s\n", s1);
	}
}

int main() {
    //freopen("test.in","r",stdin);
	while(~scanf("%d", &m)) {
		scanf("%s", str);
		n = strlen(str);
		work();
	}
	return 0;
}


#include <bits/stdc++.h>
#define fr(a,b,c) for(int (a) = (b); (a) < (c); ++(a))
#define rp(a,b) fr(a,0,b)
#define fre(a, b) for(int a = adj[b]; a != -1; a = ant[a])
#define cl(a,b) memset((a), (b), sizeof(a))
#define X first
#define Y second
#define dbg(x) if(1) cerr << ">>> " << x << endl;
#define _ << " , " <<

using namespace std;
const int inf = 0x3f3f3f3f;
const int minusinf = -inf;
const int di[] = {1, -1, 0, 0};
const int dj[] = {0, 0, 1, -1};

typedef unsigned int ui;
typedef unsigned long long ull;
typedef long long ll;
typedef std::vector<int> vi;
typedef std::pair<int, int> ii;
typedef std::vector<ii> vii;

const int M = 111111;
int bit[M], n, m;
void update(int x, int v){
	while(x <= n){
		bit[x] += v;
		x += x&-x;
	}
}

int sum(int x){
	int ret = 0;
	while(x > 0){
		ret += bit[x];
		x -= x & -x;
	}
	return ret;
}

int sum2(int l, int r){
	return (sum(r) - sum(l));
}

vii vet;

int main(){
	ios::sync_with_stdio(0);
	string ans, str;
	cin >> m;
	cin >> str;
	n = str.size();
	fr(i, 0, n)
		vet.push_back(ii(str[i], i+1));

	sort(vet.begin(), vet.end());
	int pt = 0, at = 0;
	while(at < n - m){
		while(sum2(at, at+m) == 0){
			if(vet[pt].Y <= at){
				++pt;
				continue;
			}
			ans += char(vet[pt].X);
			update(vet[pt].Y, 1);
			++pt;
		}
		++at;
	}
	cout << ans << endl;
}


#include <bits/stdc++.h>
#define fr(a,b,c) for(int (a) = (b); (a) < (c); ++(a))
#define rp(a,b) fr(a,0,b)
#define fre(a, b) for(int a = adj[b]; a != -1; a = ant[a])
#define cl(a,b) memset((a), (b), sizeof(a))
#define X first
#define Y second
#define dbg(x) if(1) cerr << ">>> " << x << endl;
#define _ << " , " <<

using namespace std;
const int inf = 0x3f3f3f3f;
const int minusinf = -inf;
const int di[] = {1, -1, 0, 0};
const int dj[] = {0, 0, 1, -1};

typedef unsigned int ui;
typedef unsigned long long ull;
typedef long long ll;
typedef std::vector<int> vi;
typedef std::pair<int, int> ii;
typedef std::vector<ii> vii;

const int M = 111111;
int bit[M], n, m;
void update(int x, int v){
	while(x <= n){
		bit[x] += v;
		x += x&-x;
	}
}

int sum(int x){
	int ret = 0;
	while(x > 0){
		ret += bit[x];
		x -= x & -x;
	}
	return ret;
}

int sum2(int l, int r){
	return (sum(r) - sum(l));
}

vii vet;

int main(){
	ios::sync_with_stdio(0);
	string ans, str;
	cin >> m;
	cin >> str;
	n = str.size();
	fr(i, 0, n)
		vet.push_back(ii(str[i], i+1));

	sort(vet.begin(), vet.end());
	int pt = 0, at = 0, pt2 = 0;
	while(at <= n - m){
		while(sum2(at, at+m) == 0){
			update(vet[pt].Y, 1);
			++pt;
		}
		++at;
	}

	memset(bit, 0, sizeof bit);
	--pt;
	at = 0;
	while(at <= n - m){
		while(sum2(at, at+m) == 0){
			if(vet[pt2].Y <= at && vet[pt].X == vet[pt2].X){
				++pt2;
				continue;
			}
			ans += char(vet[pt2].X);
			update(vet[pt2].Y, 1);
			++pt2;
		}
		++at;
	}
	cout << ans << endl;
}


#include <bits/stdc++.h>
#define fr(a,b,c) for(int (a) = (b); (a) < (c); ++(a))
#define rp(a,b) fr(a,0,b)
#define fre(a, b) for(int a = adj[b]; a != -1; a = ant[a])
#define cl(a,b) memset((a), (b), sizeof(a))
#define X first
#define Y second
#define dbg(x) if(1) cerr << ">>> " << x << endl;
#define _ << " , " <<

using namespace std;
const int inf = 0x3f3f3f3f;
const int minusinf = -inf;
const int di[] = {1, -1, 0, 0};
const int dj[] = {0, 0, 1, -1};

typedef unsigned int ui;
typedef unsigned long long ull;
typedef long long ll;
typedef std::vector<int> vi;
typedef std::pair<int, int> ii;
typedef std::vector<ii> vii;

const int M = 111111;
int bit[M], n, m;
void update(int x, int v){
	while(x <= n){
		bit[x] += v;
		x += x&-x;
	}
}

int sum(int x){
	int ret = 0;
	while(x > 0){
		ret += bit[x];
		x -= x & -x;
	}
	return ret;
}

int sum2(int l, int r){
	return (sum(r) - sum(l));
}

vii vet;

int main(){
	ios::sync_with_stdio(0);
	string ans, str;
	cin >> m;
	cin >> str;
	n = str.size();
	fr(i, 0, n)
		vet.push_back(ii(str[i], i+1));

	sort(vet.begin(), vet.end());
	int pt = 0, at = 0, pt2 = 0;
	while(at+m <= n){
		while(sum2(at, at+m) == 0){
			update(vet[pt].Y, 1);
			++pt;
		}
		++at;
	}

	memset(bit, 0, sizeof bit);
	--pt;
	at = 0;
	while(at + m <= n){
		while(sum2(at, at+m) == 0){
			while(pt2 < pt && vet[pt].X == vet[pt2].X && at < vet[pt2+1].Y && at+m >= vet[pt2+1].Y){
				++pt2;
			}
			ans += char(vet[pt2].X);
			update(vet[pt2].Y, 1);
			++pt2;
		}
		++at;
	}
	cout << ans << endl;
}


#include <bits/stdc++.h>
#define fr(a,b,c) for(int (a) = (b); (a) < (c); ++(a))
#define rp(a,b) fr(a,0,b)
#define fre(a, b) for(int a = adj[b]; a != -1; a = ant[a])
#define cl(a,b) memset((a), (b), sizeof(a))
#define X first
#define Y second
#define dbg(x) if(1) cerr << ">>> " << x << endl;
#define _ << " , " <<

using namespace std;
const int inf = 0x3f3f3f3f;
const int minusinf = -inf;
const int di[] = {1, -1, 0, 0};
const int dj[] = {0, 0, 1, -1};

typedef unsigned int ui;
typedef unsigned long long ull;
typedef long long ll;
typedef std::vector<int> vi;
typedef std::pair<int, int> ii;
typedef std::vector<ii> vii;

const int M = 111111;
int bit[M], n, m;
void update(int x, int v){
	while(x <= n){
		bit[x] += v;
		x += x&-x;
	}
}

int sum(int x){
	int ret = 0;
	while(x > 0){
		ret += bit[x];
		x -= x & -x;
	}
	return ret;
}

int sum2(int l, int r){
	return (sum(r) - sum(l));
}

vii vet;

int main(){
	ios::sync_with_stdio(0);
	string ans, str;
	cin >> m;
	cin >> str;
	n = str.size();
	fr(i, 0, n)
		vet.push_back(ii(str[i], i+1));

	sort(vet.begin(), vet.end());
	int pt = 0, at = 0, pt2 = 0;
	while(at < n - m){
		while(sum2(at, at+m) == 0){
			if(vet[pt].Y <= at){
				++pt;
				continue;
			}
			// ans += char(vet[pt].X);
			update(vet[pt].Y, 1);
			++pt;
		}
		++at;
	}
	memset(bit, 0, sizeof bit);
	--pt;
	at = 0;
	while(at < n - m){
		while(sum2(at, at+m) == 0){
			if(vet[pt2].Y <= at && vet[pt].X == vet[pt2].X){
				++pt2;
				continue;
			}
			ans += char(vet[pt2].X);
			update(vet[pt2].Y, 1);
			++pt2;
		}
		++at;
	}
	cout << ans << endl;
}


#include <bits/stdc++.h>
#define fr(a,b,c) for(int (a) = (b); (a) < (c); ++(a))
#define rp(a,b) fr(a,0,b)
#define fre(a, b) for(int a = adj[b]; a != -1; a = ant[a])
#define cl(a,b) memset((a), (b), sizeof(a))
#define X first
#define Y second
#define dbg(x) if(1) cerr << ">>> " << x << endl;
#define _ << " , " <<

using namespace std;
const int inf = 0x3f3f3f3f;
const int minusinf = -inf;
const int di[] = {1, -1, 0, 0};
const int dj[] = {0, 0, 1, -1};

typedef unsigned int ui;
typedef unsigned long long ull;
typedef long long ll;
typedef std::vector<int> vi;
typedef std::pair<int, int> ii;
typedef std::vector<ii> vii;

const int M = 111111;
int bit[M], n, m;
void update(int x, int v){
	while(x <= n){
		bit[x] += v;
		x += x&-x;
	}
}

int sum(int x){
	int ret = 0;
	while(x > 0){
		ret += bit[x];
		x -= x & -x;
	}
	return ret;
}

int sum2(int l, int r){
	return (sum(r) - sum(l));
}

vii vet;

int main(){
	ios::sync_with_stdio(0);
	string ans, str;
	cin >> m;
	cin >> str;
	n = str.size();
	fr(i, 0, n)
		vet.push_back(ii(str[i], i+1));

	sort(vet.begin(), vet.end());
	int pt = 0, at = 0, pt2 = 0;
	while(at+m <= n){
		while(sum2(at, at+m) == 0){
			update(vet[pt].Y, 1);
			++pt;
		}
		++at;
	}

	memset(bit, 0, sizeof bit);
	--pt;
	at = 0;
	while(at + m <= n){
		while(sum2(at, at+m) == 0){
			while(pt2 < pt && vet[pt].X == vet[pt2].X && ( (at < vet[pt2+1].Y && at+m >= vet[pt2+1].Y) || vet[pt2+1].Y <= at) {
				++pt2;
			}
			ans += char(vet[pt2].X);
			update(vet[pt2].Y, 1);
			++pt2;
		}
		++at;
	}
	cout << ans << endl;
}


#include <bits/stdc++.h>
#define fr(a,b,c) for(int (a) = (b); (a) < (c); ++(a))
#define rp(a,b) fr(a,0,b)
#define fre(a, b) for(int a = adj[b]; a != -1; a = ant[a])
#define cl(a,b) memset((a), (b), sizeof(a))
#define X first
#define Y second
#define dbg(x) if(1) cerr << ">>> " << x << endl;
#define _ << " , " <<

using namespace std;
const int inf = 0x3f3f3f3f;
const int minusinf = -inf;
const int di[] = {1, -1, 0, 0};
const int dj[] = {0, 0, 1, -1};

typedef unsigned int ui;
typedef unsigned long long ull;
typedef long long ll;
typedef std::vector<int> vi;
typedef std::pair<int, int> ii;
typedef std::vector<ii> vii;

const int M = 111111;
int bit[M], n, m;
void update(int x, int v){
	while(x <= n){
		bit[x] += v;
		x += x&-x;
	}
}

int sum(int x){
	int ret = 0;
	while(x > 0){
		ret += bit[x];
		x -= x & -x;
	}
	return ret;
}

int sum2(int l, int r){
	return (sum(r) - sum(l));
}

vii vet;

int main(){
	ios::sync_with_stdio(0);
	string ans, str;
	cin >> m;
	cin >> str;
	n = str.size();
	fr(i, 0, n)
		vet.push_back(ii(str[i], i+1));

	sort(vet.begin(), vet.end());
	int pt = 0, at = 0, pt2 = 0;
	while(at+m <= n){
		while(sum2(at, at+m) == 0){
			update(vet[pt].Y, 1);
			++pt;
		}
		++at;
	}

	memset(bit, 0, sizeof bit);
	--pt;
	at = 0;
	while(at + m <= n){
		while(sum2(at, at+m) == 0){
			while(pt2 < pt && vet[pt].X == vet[pt2].X && ( (at < vet[pt2+1].Y && at+m >= vet[pt2+1].Y) || vet[pt2+1].Y <= at)) {
				++pt2;
			}
			ans += char(vet[pt2].X);
			update(vet[pt2].Y, 1);
			++pt2;
		}
		++at;
	}
	cout << ans << endl;
}


#include <iostream>
#include <stdio.h>
#include <string.h>
#include <math.h>
#include <algorithm>
using namespace std;
#define fr(_i_,_n_) for (int _i_=1;_i_<=_n_;_i_++)

#define M 100010
char a[M];
int s[26][M],h[26],t[26];
bool u[M];
int find(){
	for (int i=0;i<26;i++) {
		if (h[i]+1!=t[i]) {
			u[s[i][h[i]]]=true; h[i]--;
			return s[i][h[i]+1];
		}
	}
}
void advance(int x){
	for (int i=0;i<26;i++) {
		while (t[i]!=h[i]+1 && s[i][t[i]]<=x) t[i]++;
	}
}
int main(){
	int m; scanf("%d",&m);
	scanf("%s",a);
	int len=strlen(a);
	int i;
	for (i=0;i<26;i++) h[i]=0,t[i]=1;
	int k=-1; i=0;
	for (;;) {
		for (;i<len&&i<=k+m;i++) {
			int p=a[i]-97;
			h[p]++; s[p][h[p]]=i;
		}
		advance(k);
		i=find(); k=i;
		if (i+m>=len) break;
	}
	int max=0;
	memset(h,0,sizeof(h));
	for (int i=0;i<len;i++) if (u[i]) if (a[i]>max) max=a[i];
	for (int i=0;i<len;i++) if (a[i]<max) u[i]=true;
	for (int i=0;i<len;i++) if (u[i]) h[a[i]-97]++;
	for (int i=0;i<26;i++) {
		while (h[i]) putchar(i+97),h[i]--;
	}
	printf("\n");
}


#include <iostream>
#include <stdio.h>
#include <string.h>
#include <math.h>
#include <algorithm>
using namespace std;
#define fr(_i_,_n_) for (int _i_=1;_i_<=_n_;_i_++)

#define M 100010
char a[M];
int s[M][26],h[26],t[26];
bool u[M];
int find(){
	for (int i=0;i<26;i++) {
		if (h[i]+1!=t[i]) {
			u[s[i][h[i]]]=true; h[i]--;
			return s[i][h[i]+1];
		}
	}
}
void advance(int x){
	for (int i=0;i<26;i++) {
		while (t[i]!=h[i]+1 && s[i][t[i]]<=x) t[i]++;
	}
}
int main(){
	int m; scanf("%d",&m);
	scanf("%s",a);
	int len=strlen(a);
	//printf("len=%d\n",len);
	int i;
	for (i=0;i<26;i++) h[i]=0,t[i]=1;
	int k=-1; i=0;
	for (;;) {
		for (;i<len&&i<=k+m;i++) {
			int p=a[i]-97;
			h[p]++; s[p][h[p]]=i;
			//printf("add: %d\n",p);
		}
		//printf("i=%d\n",i);
		//for (int j=0;j<=3;j++) printf("%d, h=%d, t=%d\n",j,h[j],t[j]);
		advance(k);
		//for (int j=0;j<=3;j++) printf("%d, h=%d, t=%d\n",j,h[j],t[j]);
		i=find(); k=i;
		//printf("fi=%d\n",i);
		//break;
		if (i+m>=len) break;
	}
	//for (int i=0;i<len;i++) printf("%d",u[i]?1:0);
	//printf("\n");
	int max=0;
	memset(h,0,sizeof(h));
	for (int i=0;i<len;i++) if (u[i]) if (a[i]>max) max=a[i];
	for (int i=0;i<len;i++) if (a[i]<max) u[i]=true;
	for (int i=0;i<len;i++) if (u[i]) h[a[i]-97]++;
	for (int i=0;i<26;i++) {
		while (h[i]) putchar(i+97),h[i]--;
	}
	printf("\n");
}


#include <iostream>
#include <stdio.h>
#include <string.h>
#include <math.h>
#include <algorithm>
using namespace std;
#define fr(_i_,_n_) for (int _i_=1;_i_<=_n_;_i_++)

#define M 100010
char a[M];
int s[M][26],h[26],t[26];
bool u[M];
int find(){
	for (int i=0;i<26;i++) {
		if (h[i]+1!=t[i]) {
			u[s[i][h[i]]]=true; h[i]--;
			return s[i][h[i]+1];
		}
	}
}
void advance(int x){
	for (int i=0;i<26;i++) {
		while (t[i]!=h[i]+1 && s[i][t[i]]<=x) t[i]++;
	}
}
int main(){
	int m; scanf("%d",&m);
	scanf("%s",a);
	int len=strlen(a);
	//printf("len=%d\n",len);
	int i;
	for (i=0;i<26;i++) h[i]=0,t[i]=1;
	int k=-1; i=0;
	for (;;) {
		for (;i<len&&i<=k+m;i++) {
			int p=a[i]-97;
			h[p]++; s[p][h[p]]=i;
			//printf("add: %d\n",p);
		}
		//printf("i=%d\n",i);
		//for (int j=0;j<=3;j++) printf("%d, h=%d, t=%d\n",j,h[j],t[j]);
		advance(k);
		//for (int j=0;j<=3;j++) printf("%d, h=%d, t=%d\n",j,h[j],t[j]);
		i=find()+1; k=i;
		//printf("fi=%d\n",i);
		//break;
		if (i+m>=len) break;
	}
	//for (int i=0;i<len;i++) printf("%d",u[i]?1:0);
	//printf("\n");
	int max=0;
	memset(h,0,sizeof(h));
	for (int i=0;i<len;i++) if (u[i]) if (a[i]>max) max=a[i];
	for (int i=0;i<len;i++) if (a[i]<max) u[i]=true;
	for (int i=0;i<len;i++) if (u[i]) h[a[i]-97]++;
	for (int i=0;i<26;i++) {
		while (h[i]) putchar(i+97),h[i]--;
	}
	printf("\n");
}


#include<cstdio>
#include<cstring>
#include<cmath>
#include<algorithm>
#include<string>
#include<iostream>
#include<set>
#define LL long long
using namespace std;
int l,len;
struct Node
{
	int id;
	char x;
}f[100005];
char s[100005];
set<int> S;
set<int>::iterator it;
inline bool cmp(Node A,Node B)
{
	if(A.x==B.x) return A.id<B.id;
	return A.x<B.x;
}
int main()
{
	scanf("%d",&l);
	scanf("%s",s);
	len=strlen(s);
	for(int i=0;i<len;i++)
	{
		f[i+1].x=s[i];f[i+1].id=i+1;
	}
	sort(f+1,f+len+1,cmp);
	string ans="";
	for(int i=1;i<=len;i++)
	{
		int x=f[i].id;
		it=S.lower_bound(x);
		int L,R;
		if(it==S.end())
			R=len;
		else
			R=(*it)-1;
		if(it==S.begin())
			L=1;
		else
		{
			it--;
			L=(*it)+1;
		}
		if(R-L+1>=l)
		{
			ans+=f[i].x;
			S.insert(f[i].id);
		}
	}
	cout<<ans<<endl;
	return 0;
}


#include<cstdio>
#include<cstring>
#include<cmath>
#include<algorithm>
#include<string>
#include<iostream>
#define LL long long
using namespace std;
int l,len;
inline int lowbit(int x)
{
	return x&(-x);
}
struct Node
{
	int id;
	char x;
}f[100005];
char s[100005];
int C[100005];
inline bool cmp(Node A,Node B)
{
	if(A.x==B.x) return A.id<B.id;
	return A.x<B.x;
}
inline void update(int pos)
{
	while(pos<=len)
	{
		C[pos]++;
		pos+=lowbit(pos);
	}
}
inline int query(int pos)
{
	int ret=0;
	while(pos>0)
	{
		ret+=C[pos];
		pos-=lowbit(pos);
	}
	return ret;
}
int main()
{
	scanf("%d",&l);
	scanf("%s",s);
	len=strlen(s);
	for(int i=0;i<len;i++)
	{
		f[i+1].x=s[i];f[i+1].id=i+1;
	}
	sort(f+1,f+len+1,cmp);
	string ans="";
	for(int i=1;i<=len;i++)
	{
		int pos=f[i].id;
		int L=pos-l+1;int R=pos+l-1;
		//cout<<L<<" "<<R<<endl;
		if(L>=1)
		{
			int p=query(pos)-query(L-1);
			if(p==0)
			{
				update(pos);
				ans+=f[i].x;
				continue;
			}
		}
		if(R<=len)
		{
			int p=query(R)-query(pos-1);
			if(p==0)
			{
				update(pos);
				ans+=f[i].x;
				continue;
			}
		}
	}
	cout<<ans<<endl;
	return 0;
}


#include<cstdio>
#include<cstring>
#include<cmath>
#include<algorithm>
#include<string>
#include<iostream>
#include<set>
#include<vector>
#define LL long long
using namespace std;
int x;
char s[100005];
bool flag[500];
int cnt[500];
vector<char> f;
int main()
{
	scanf("%d",&x);
	scanf("%s",s);
	int len=strlen(s);
	for(int i=0;i<len;i++)
		cnt[s[i]]++;
	for(int i='a';i<='z';i++)
	{
		if(cnt[i]==0) continue;
		flag[i]=1;int pre=-1;bool tag=0;
		f.push_back(char(i));
		for(int j=0;j<len;j++)
		{
			if(flag[s[j]])
			{
				pre=j;
				continue;
			}
			int y=j-pre;
			if(y>=x)
			{
				tag=1;
				break;
			}
		}
		if(tag)
			continue;
		else
		{
			cnt[i]=0;
			flag[i]=0;int pos=-1;int pre=-1;
			for(int j=0;j<len;j++)
			{
				if(s[j]==i)
				{
					pos=max(pos,j);
				}
				if(flag[s[j]])
				{
					pre=j;
					continue;
				}
				int y=j-pre;
				if(y>=x)
				{
					pre=pos;
					cnt[i]++;
				}
			}
			break;
		}
	}
	string ans="";
	int p=f.size();
	for(int i=0;i<p;i++)
	{
		for(int j=1;j<=cnt[f[i]];j++)
			ans+=f[i];
	}
	cout<<ans<<endl;
	return 0;
}


#include <bits/stdc++.h>
#define pb push_back
#define mp make_pair
#define fst first
#define snd second
#define fore(i,a,b) for(int i=a,to=b;i<to;++i)
#define mod 1000000009
using namespace std;

typedef long long ll;
typedef pair<int,int> ii;
const int N = 510500;
char c[N],t;
int n,vis[N],m;
bool ok() {
	int l = 0;
	fore(i,0,n) {
		if(c[i] > t)
			l++;
		else
			l=0;
		if(l == m)
			return 0;
	}
	return 1;
}
int main(){
	scanf("%d",&m);
	scanf("%s",c);
	n = strlen(c);
	for(t = 'a';t<='z';t++) if(ok()) break;

	t--;
	int l = 0;
	vector<char> ans;
	fore(i,0,n-m+1) {
		if(c[i] > t)
			l++;
		else
			l = 0;
		if(l == m) {
			l = 0;
			ans.pb(t+1);
		}
	}
	fore(i,0,n)
		if(c[i]<=t)
			ans.pb(c[i]);
	sort(ans.begin(),ans.end());
	fore(i,0,ans.size())
		putchar(ans[i]);
	puts("");

	return 0;
}


#include <bits/stdc++.h>
#define fore(i,a,n) for(int i=a;i<n;i++)
#define pb push_back
#define mp make_pair
#define endl '\n'
#define EPS 1e-12
#define fst first
#define snd second
using namespace std;

typedef long long ll;
typedef pair<int,int> ii;
const int N = 100505;
const ll mod = (ll) 1e9 + 7;
int st[4*N];
char c[N];
int q[N];
vector<char> ans;
int main() {
	int n,m;
	scanf("%d",&m);
	scanf("%s",c);
	char w = 'z';
	n = strlen(c);
	int k = 1,last = -1;
	fore(i,0,m)
		if(c[i] <= w) {
			w = c[i];
			last = i;
		}
	ans.pb(w);
	while(k<n-m+1) {
		if(last < k)
			last = k,w = c[k];
		fore(j,last,k+m) {
			if(c[j] <= w) {
				w = c[j];
				last = j;
			}
		}
		k++;
		ans.pb(w);
	}
	sort(ans.begin(),ans.end());
	bool f = ans[0] == ans[ans.size()-1];
	w = ans[ans.size()-1];
	if(f) {
		fore(i,0,(n)/m)
			putchar(w);
		puts("");
		return 0;
	}
	ans.clear();
	k = 0;
	bool s = 0;
	q[1] = (c[0] < w);
	fore(i,2,n)
		q[i] = q[i-1] +( c[i-1]<w);
	last = -1;
	while(k < n-m+1) {
		if(c[k] < w)
			last = max(k,last);
		else if(k >= last){
			if(q[k+m]-q[k] == 0) {
				ans.pb(w);
				last = k+m-1;
			}
		}
		k++;
	}
	fore(i,0,n)
		if(c[i] < w)
			ans.pb(c[i]);
	sort(ans.begin(),ans.end());
	fore(i,0,ans.size())
		c[i] = ans[i];
	c[ans.size()] = '\0';
	printf("%s\n",c);

}


#include <bits/stdc++.h>
#define fore(i,a,n) for(int i=a;i<n;i++)
#define pb push_back
#define mp make_pair
#define endl '\n'
#define EPS 1e-12
#define fst first
#define snd second
using namespace std;

typedef long long ll;
typedef pair<int,int> ii;
const int N = 100505;
const ll mod = (ll) 1e9 + 7;
int st[4*N];
char c[N];
int q[N];
vector<char> ans;
int main() {
	int n,m;
	scanf("%d",&m);
	scanf("%s",c);
	char w = 'z';
	n = strlen(c);
	int k = 1,last = -1;
	fore(i,0,m)
		if(c[i] <= w) {
			w = c[i];
			last = i;
		}
	ans.pb(w);
	while(k<n-m+1) {
		if(last < k)
			last = k,w = c[k];
		fore(j,last,k+m) {
			if(c[j] <= w) {
				w = c[j];
				last = j;
			}
		}
		k++;
		ans.pb(w);
	}
	sort(ans.begin(),ans.end());
	bool f = ans[0] == ans[ans.size()-1];
	w = ans[ans.size()-1];
	if(f) {
		w++;
	}
	ans.clear();
	k = 0;
	bool s = 0;
	q[1] = (c[0] < w);
	fore(i,2,n)
		q[i] = q[i-1] +( c[i-1]<w);
	last = -1;
	while(k < n-m+1) {
		if(c[k] < w)
			last = max(k,last);
		else if(k >= last){
			if(q[k+m]-q[k] == 0) {
				ans.pb(w);
				last = k+m-1;
			}
		}
		k++;
	}
	fore(i,0,n)
		if(c[i] < w)
			ans.pb(c[i]);
	sort(ans.begin(),ans.end());
	fore(i,0,ans.size())
		c[i] = ans[i];
	c[ans.size()] = '\0';
	printf("%s\n",c);

}


#include <bits/stdc++.h>
#define pb push_back
#define mp make_pair
#define fst first
#define snd second
#define fore(i,a,b) for(int i=a,to=b;i<to;++i)
#define mod 1000000009
using namespace std;

typedef long long ll;
typedef pair<int,int> ii;
const int N = 510500;
char c[N],t;
int n,vis[N],m;
bool ok() {
	int l = 0;
	fore(i,0,n) {
		if(c[i] > t)
			l++;
		else
			l=0;
		if(l == m)
			return 0;
	}
	return 1;
}
int main(){
	scanf("%d",&m);
	scanf("%s",c);
	n = strlen(c);
	for(t = 'a';t<='z';t++) if(ok()) break;

	int l = 0,last = -1;
	vector<char> ans;
	fore(i,0,n) {
		if(c[i] > t)
			l++;
		else if(c[i] == t) {
			l++;
			last = i;
		} else {
			l = 0;
			ans.pb(c[i]);
		}
		if(l == m) {
			l = i-last;
			ans.pb(t);
		}
	}
	sort(ans.begin(),ans.end());
	fore(i,0,ans.size())
		putchar(ans[i]);
	puts("");
	return 0;
}


#include <bits/stdc++.h>
#define pb push_back
#define mp make_pair
#define fst first
#define snd second
#define fore(i,a,b) for(int i=a,to=b;i<to;++i)
#define mod 1000000009
using namespace std;

typedef long long ll;
typedef pair<int,int> ii;
const int N = 510500;
char c[N],t;
int n,vis[N],m;
bool ok() {
	int l = 0;
	fore(i,0,n-m+1) {
		if(c[i] > t)
			l++;
		else
			l=0;
		if(l == m)
			return 0;
	}
	return 1;
}
int main(){
	scanf("%d",&m);
	scanf("%s",c);
	n = strlen(c);
	for(t = 'a';t<='z';t++) if(ok()) break;

	t--;
	int l = 0;
	vector<char> ans;
	fore(i,0,n) {
		if(c[i] > t)
			l++;
		else
			l = 0;
		if(l == m) {
			l = 0;
			ans.pb(t+1);
		}
	}
	fore(i,0,n)
		if(c[i]<=t)
			ans.pb(c[i]);
	sort(ans.begin(),ans.end());
	fore(i,0,ans.size())
		putchar(ans[i]);
	puts("");

	return 0;
}


#include <bits/stdc++.h>
#define pb push_back
#define mp make_pair
#define fst first
#define snd second
#define fore(i,a,b) for(int i=a,to=b;i<to;++i)
#define mod 1000000009
using namespace std;

typedef long long ll;
typedef pair<int,int> ii;
const int N = 510500;
char c[N],t;
int n,vis[N],m;
bool ok() {
	int l = 0;
	fore(i,0,n) {
		if(c[i] > t)
			l++;
		else
			l=0;
		if(l == m)
			return 0;
	}
	return 1;
}
int main(){
	scanf("%d",&m);
	scanf("%s",c);
	n = strlen(c);
	for(t = 'a';t<='z';t++) if(ok()) break;

	int l = 0,last = -1;
	vector<char> ans;
	fore(i,0,n) {
		if(c[i] > t)
			l++;
		else if(c[i] == t) {
			l++;
			last = i;
		} else {
			l = 0;
			ans.pb(c[i]);
		}
		if(l == m) {
			l = last-i;
			ans.pb(t);
		}
	}
	sort(ans.begin(),ans.end());
	fore(i,0,ans.size())
		putchar(ans[i]);
	puts("");
	return 0;
}


#include <bits/stdc++.h>
#define fore(i,a,n) for(int i=a;i<n;i++)
#define pb push_back
#define mp make_pair
#define endl '\n'
#define EPS 1e-12
#define fst first
#define snd second
using namespace std;

typedef long long ll;
typedef pair<int,int> ii;
const int N = 200505;
const ll mod = (ll) 1e9 + 7;
int st[4*N];
char c[N];
bool vis[N];
void b(int k, int s, int e) {
	if(s+1==e) {
		st[k] = s;
		return;
	}
	int mid = (s+e)/2;
	b(2*k,s,mid);
	b(2*k+1,mid,e);

	if(c[st[2*k]] <= c[st[2*k+1]]) {
		st[k] = st[2*k];
		return;
	}
	st[k] = st[2*k+1];
	return;
}
int q(int k, int s, int e, int a, int b) {
	if(s >= a && e <= b)
		return st[k];
	if(s >= b || e <= a)
		return -1;
	int mid = (s+e)/2;
	int v1 = q(2*k,s,mid,a,b);
	int v2 = q(2*k+1,mid,e,a,b);

	if(v1 == -1)
		return v2;
	else if(v2 == -1)
		return v1;

	if(c[v1] <= c[v2])
		return v1;
	return v2;
}

int main() {
	int n,m;
	scanf("%d",&m);
	scanf("%s",c);
	n = strlen(c);
	b(1,0,n);
	int last = q(1,0,n,0,m);
	char l = c[last];
	vis[last] = 1;
	fore(i,1,n-m+1) {
		int v1 = q(1,0,n,i,i+m);
		if(c[v1] == l && i <= last)
			continue;
		vis[v1] = 1;
		last = v1;
		l = c[v1];

	}
	vector<char> ans;
	fore(i,0,N)
		if(vis[i])
			ans.pb(c[i]);
	sort(ans.begin(),ans.end());
	char w = c[ans.size()-1];
	int h = n-1;
	while(h >= 0) {
		if(c[h] != w) {
			h--;
			continue;
		}
		for(int i=h-1;i>=max(0,h-m+1);i--)
			if(vis[i] && c[i] == w)
				vis[i] = 0;
		h -=m;
	}
	ans.clear();
	fore(i,0,N)
		if(vis[i])
			ans.pb(c[i]);
	sort(ans.begin(),ans.end());
	bool fa = 1;
	fore(i,0,ans.size())
		if(ans[i] != ans[0])
			fa = 0;
	if(fa) {
		ans.clear();
		int last;
		for(int i=m-1;i>=0;i--)
			if(vis[i]) {
				last = i;
				break;
			}
		ans.pb(c[last]);
		fore(i,1,n-m+1)
			if(last >= i)
				continue;
			else {
				for(int j=i+m-1;i>=i;j--)
					if(vis[j]) {
						last = j;
						break;
					}
				ans.pb(c[last]);
			}
	}
	fore(i,0,ans.size())
		c[i] = ans[i];
	c[(int)ans.size()] = '\0';
	printf("%s\n",c);
}


#include <bits/stdc++.h>
#define pb push_back
#define mp make_pair
#define fst first
#define snd second
#define fore(i,a,b) for(int i=a,to=b;i<to;++i)
#define mod 1000000009
using namespace std;

typedef long long ll;
typedef pair<int,int> ii;
const int N = 510500;
char c[N],t;
int n,vis[N],m;
bool ok() {
	int l = 0;
	fore(i,0,n) {
		if(c[i] > t)
			l++;
		else
			l=0;
		if(l == m)
			return 0;
	}
	return 1;
}
int main(){
	scanf("%d",&m);
	scanf("%s",c);
	n = strlen(c);
	for(t = 'a';t<='z';t++) if(ok()) break;

	int l = 0,last = -1;
	vector<char> ans;
	fore(i,0,n) {
		if(c[i] > t)
			l++;
		else if(c[i] == t) {
			l++;
			last = i;
		} else {
			l = 0;
			last = i;
			ans.pb(c[i]);
		}
		if(l == m) {
			l = last-i;
			ans.pb(t);
		}
	}
	sort(ans.begin(),ans.end());
	fore(i,0,ans.size())
		putchar(ans[i]);
	puts("");
	return 0;
}


#include <bits/stdc++.h>
#define fore(i,a,n) for(int i=a;i<n;i++)
#define pb push_back
#define mp make_pair
#define endl '\n'
#define EPS 1e-12
#define fst first
#define snd second
using namespace std;

typedef long long ll;
typedef pair<int,int> ii;
const int N = 100505;
const ll mod = (ll) 1e9 + 7;
int st[4*N];
char c[N];
int q[N];
vector<char> ans;
int main() {
	int n,m;
	scanf("%d",&m);
	scanf("%s",c);
	char w = 'z';
	n = strlen(c);
	int k = 1,last = -1;
	fore(i,0,m)
		if(c[i] <= w) {
			w = c[i];
			last = i;
		}
	ans.pb(w);
	while(k<n-m+1) {
		if(last < k)
			last = k,w = c[k];
		fore(j,last,k+m) {
			if(c[j] <= w) {
				w = c[j];
				last = j;
			}
		}
		k++;
		ans.pb(w);
	}
	sort(ans.begin(),ans.end());
	bool f = ans[0] == ans[ans.size()-1];
	w = ans[ans.size()-1];
	if(f) {
		fore(i,0,(n)/m)
			putchar(w);
		puts("");
		return 0;
	}
	ans.clear();
	k = 0;
	bool s = 0;
	q[1] = (c[0] < w);
	fore(i,2,n)
		q[i] = q[i-1] +( c[i-1]<w);
	last = -1;
	while(k < n-m+1) {
		if(c[k] < w)
			last = max(k,last);
		else if(k >= last){
			if(q[k+m]-q[k] == 0) {
				ans.pb(w);
				last = k+m;
			}
		}
		k++;
	}
	fore(i,0,n)
		if(c[i] < w)
			ans.pb(c[i]);
	sort(ans.begin(),ans.end());
	fore(i,0,ans.size())
		c[i] = ans[i];
	c[ans.size()] = '\0';
	printf("%s\n",c);

}


#include <bits/stdc++.h>
#define pb push_back
#define mp make_pair
#define fst first
#define snd second
#define fore(i,a,b) for(int i=a,to=b;i<to;++i)
#define mod 1000000009
using namespace std;

typedef long long ll;
typedef pair<int,int> ii;
const int N = 510500;
char c[N],t;
int n,vis[N],m;
bool ok() {
	int l = 0;
	fore(i,0,n) {
		if(c[i] > t)
			l++;
		else
			l=0;
		if(l == m)
			return 0;
	}
	return 1;
}
int main(){
	scanf("%d",&m);
	scanf("%s",c);
	n = strlen(c);
	for(t = 'a';t<='z';t++) if(ok()) break;

	t--;
	int l = 0;
	vector<char> ans;
	fore(i,0,n) {
		if(c[i] > t)
			l++;
		else
			l = 0;
		if(l == m) {
			l = 0;
			ans.pb(t+1);
		}
		if(i == n-m) {
			if(l)
				ans.pb(t+1);
			break;
		}
	}
	fore(i,0,n)
		if(c[i]<=t)
			ans.pb(c[i]);
	sort(ans.begin(),ans.end());
	fore(i,0,ans.size())
		putchar(ans[i]);
	puts("");

	return 0;
}


#include <bits/stdc++.h>
#define fore(i,a,n) for(int i=a;i<n;i++)
#define pb push_back
#define mp make_pair
#define endl '\n'
#define EPS 1e-12
#define fst first
#define snd second
using namespace std;

typedef long long ll;
typedef pair<int,int> ii;
const int N = 100505;
const ll mod = (ll) 1e9 + 7;
int st[4*N];
char c[N];
bool vis[N];
void b(int k, int s, int e) {
	if(s+1==e) {
		st[k] = s;
		return;
	}
	int mid = (s+e)/2;
	b(2*k,s,mid);
	b(2*k+1,mid,e);
	if(c[st[2*k]] < c[st[2*k+1]]) {
		st[k] = st[2*k];
		return;
	}
	st[k] = st[2*k+1];
	return;
}
int q(int k, int s, int e, int a, int b) {
	if(s >= a && e <= b)
		return st[k];
	if(s >= b || e <= a)
		return -1;
	int mid = (s+e)/2;
	int v1 = q(2*k,s,mid,a,b);
	int v2 = q(2*k+1,mid,e,a,b);

	if(v1 == -1)
		return v2;
	else if(v2 == -1)
		return v1;

	if(c[v1] < c[v2])
		return v1;
	return v2;
}

int main() {
	int n,m;
	scanf("%d",&m);
	scanf("%s",c);
	n = strlen(c);
	b(1,0,n);
	int last = q(1,0,n,0,m);
	char l = c[last];
	vis[last] = 1;
	fore(i,1,n-m+1) {
		int v1 = q(1,0,n,i,i+m);
		if(c[v1] == l && i <= last)
			continue;
		vis[v1] = 1;
		last = v1;
		l = c[v1];

	}
	vector<char> ans;
	fore(i,0,N)
		if(vis[i])
			ans.pb(c[i]);
	sort(ans.begin(),ans.end());
	fore(i,0,ans.size())
		c[i] = ans[i];
	c[ans.size()] = '\0';
	printf("%s\n",c);
}


#include <bits/stdc++.h>
#define fore(i,a,n) for(int i=a;i<n;i++)
#define pb push_back
#define mp make_pair
#define endl '\n'
#define EPS 1e-12
#define fst first
#define snd second
using namespace std;

typedef long long ll;
typedef pair<int,int> ii;
const int N = 200505;
int st[4*N];
char c[N];
bool vis[N];
void b(int k, int s, int e) {
	if(s+1==e) {
		st[k] = s;
		return;
	}
	int mid = (s+e)/2;
	b(2*k,s,mid);
	b(2*k+1,mid,e);
	if(c[st[2*k]] < c[st[2*k+1]]) {
		st[k] = st[2*k];
		return;
	}
	st[k] = st[2*k+1];
	return;
}
int q(int k, int s, int e, int a, int b) {
	if(s >= a && e <= b)
		return st[k];
	if(s >= b || e <= a)
		return -1;
	int mid = (s+e)/2;
	int v1 = q(2*k,s,mid,a,b);
	int v2 = q(2*k+1,mid,e,a,b);

	if(v1 == -1)
		return v2;
	else if(v2 == -1)
		return v1;

	if(c[v1] < c[v2])
		return v1;
	return v2;
}

int main() {
	int n,m;
	scanf("%d",&m);
	scanf("%s",c);
	n = strlen(c);
	b(1,0,n);
	int last = q(1,0,n,0,m);
	char l = c[last];
	vis[last] = 1;
	fore(i,1,n-m+1) {
		int v1 = q(1,0,n,i,i+m);
		if(c[v1] == l && i <= last)
			continue;
		vis[v1] = 1;
		last = v1;
		l = c[v1];

	}
	vector<char> ans;
	fore(i,0,N)
		if(vis[i])
			ans.pb(c[i]);
	sort(ans.begin(),ans.end());
	fore(i,0,ans.size())
		c[i] = ans[i];
	c[(int)ans.size()] = '\0';
	printf("%s\n",c);
}


#include <bits/stdc++.h>
#define fore(i,a,n) for(int i=a;i<n;i++)
#define pb push_back
#define mp make_pair
#define endl '\n'
#define EPS 1e-12
#define fst first
#define snd second
using namespace std;

typedef long long ll;
typedef pair<int,int> ii;
const int N = 100505;
const ll mod = (ll) 1e9 + 7;
int st[4*N];
char c[N];
int q[N];
vector<char> ans;
int main() {
	int n,m;
	scanf("%d",&m);
	scanf("%s",c);
	char w = 'z';
	n = strlen(c);
	int k = 1,last = -1;
	fore(i,0,m)
		if(c[i] <= w) {
			w = c[i];
			last = i;
		}
	ans.pb(w);
	while(k<n-m+1) {
		if(last < k)
			last = k,w = c[k];
		fore(j,last,k+m) {
			if(c[j] <= w) {
				w = c[j];
				last = j;
			}
		}
		k++;
		ans.pb(w);
	}
	sort(ans.begin(),ans.end());
	bool f = ans[0] == ans[ans.size()-1];
	w = ans[ans.size()-1];
	if(f) {
		fore(i,0,(n)/m)
			putchar(w);
		puts("");
		return 0;
	}
	ans.clear();
	k = 0;
	bool s = 0;
	q[1] = (c[0] < w);
	fore(i,2,n)
		q[i] = q[i-1] +( c[i-1]<w);
	last = -1;
	while(k < n-m+1) {
		if(c[k] < w)
			last = max(k,last);
		else if(k > last){
			if(q[k+m]-q[k] == 0) {
				ans.pb(w);
				last = k+m;
			}
		}
		k++;
	}
	fore(i,0,n)
		if(c[i] < w)
			ans.pb(c[i]);
	sort(ans.begin(),ans.end());
	fore(i,0,ans.size())
		c[i] = ans[i];
	c[ans.size()] = '\0';
	printf("%s\n",c);

}


#include <bits/stdc++.h>
#define fore(i,a,n) for(int i=a;i<n;i++)
#define pb push_back
#define mp make_pair
#define endl '\n'
#define EPS 1e-12
#define fst first
#define snd second
using namespace std;

typedef long long ll;
typedef pair<int,int> ii;
const int N = 200505;
const ll mod = (ll) 1e9 + 7;
int st[4*N];
char c[N];
bool vis[N];
void b(int k, int s, int e) {
	if(s+1==e) {
		st[k] = s;
		return;
	}
	int mid = (s+e)/2;
	b(2*k,s,mid);
	b(2*k+1,mid,e);

	if(c[st[2*k]] <= c[st[2*k+1]]) {
		st[k] = st[2*k];
		return;
	}
	st[k] = st[2*k+1];
	return;
}
int q(int k, int s, int e, int a, int b) {
	if(s >= a && e <= b)
		return st[k];
	if(s >= b || e <= a)
		return -1;
	int mid = (s+e)/2;
	int v1 = q(2*k,s,mid,a,b);
	int v2 = q(2*k+1,mid,e,a,b);

	if(v1 == -1)
		return v2;
	else if(v2 == -1)
		return v1;

	if(c[v1] <= c[v2])
		return v1;
	return v2;
}

int main() {
	int n,m;
	scanf("%d",&m);
	scanf("%s",c);
	n = strlen(c);
	b(1,0,n);
	int last = q(1,0,n,0,m);
	char l = c[last];
	vis[last] = 1;
	fore(i,1,n-m+1) {
		int v1 = q(1,0,n,i,i+m);
		if(c[v1] == l && i <= last)
			continue;
		vis[v1] = 1;
		last = v1;
		l = c[v1];

	}
	vector<char> ans;
	fore(i,0,N)
		if(vis[i])
			ans.pb(c[i]);
	sort(ans.begin(),ans.end());
	char w = c[ans.size()-1];
	int h = n-1;
	while(h >= 0) {
		if(c[h] != w) {
			h--;
			continue;
		}
		for(int i=h-1;i>=max(0,h-m+1);i--)
			if(vis[i] && c[i] == w)
				vis[i] = 0;
		h -=m+1;
	}
	ans.clear();
	fore(i,0,N)
		if(vis[i])
			ans.pb(c[i]);
	sort(ans.begin(),ans.end());
	bool fa = 1;
	fore(i,0,ans.size())
		if(ans[i] != ans[0])
			fa = 0;
	if(fa) {
		ans.clear();
		int last;
		for(int i=m-1;i>=0;i--)
			if(vis[i]) {
				last = i;
				break;
			}
		ans.pb(c[last]);
		fore(i,1,n-m+1)
			if(last >= i)
				continue;
			else {
				for(int j=i+m-1;j>=i;j--)
					if(vis[j]) {
						last = j;
						break;
					}
				ans.pb(c[last]);
			}
	}
	fore(i,0,ans.size())
		c[i] = ans[i];
	c[(int)ans.size()] = '\0';
	printf("%s\n",c);
}


#include <bits/stdc++.h>
#define pb push_back
#define mp make_pair
#define fst first
#define snd second
#define fore(i,a,b) for(int i=a,to=b;i<to;++i)
#define mod 1000000009
using namespace std;

typedef long long ll;
typedef pair<int,int> ii;
const int N = 510500;
char c[N],t;
int n,vis[N],m;
bool ok() {
	int l = 0;
	fore(i,0,n) {
		if(c[i] > t)
			l++;
		else
			l=0;
		if(l == m)
			return 0;
	}
	return 1;
}
int main(){
	scanf("%d",&m);
	scanf("%s",c);
	n = strlen(c);
	for(t = 'a';t<='z';t++) if(ok()) break;

	t--;
	int l = 0;
	vector<char> ans;
	fore(i,0,n) {
		if(c[i] > t)
			l++;
		else
			l = 0;
		if(l == m) {
			l = 0;
			ans.pb(t+1);
		}
	}
	fore(i,0,n)
		if(c[i]<=t)
			ans.pb(c[i]);
	sort(ans.begin(),ans.end());
	fore(i,0,ans.size())
		putchar(ans[i]);
	puts("");

	return 0;
}


#include <bits/stdc++.h>
#define fore(i,a,n) for(int i=a;i<n;i++)
#define pb push_back
#define mp make_pair
#define endl '\n'
#define EPS 1e-12
#define fst first
#define snd second
using namespace std;

typedef long long ll;
typedef pair<int,int> ii;
const int N = 200505;
const ll mod = (ll) 1e9 + 7;
int st[4*N];
char c[N];
bool vis[N];
void b(int k, int s, int e) {
	if(s+1==e) {
		st[k] = s;
		return;
	}
	int mid = (s+e)/2;
	b(2*k,s,mid);
	b(2*k+1,mid,e);

	if(c[st[2*k]] <= c[st[2*k+1]]) {
		st[k] = st[2*k];
		return;
	}
	st[k] = st[2*k+1];
	return;
}
int q(int k, int s, int e, int a, int b) {
	if(s >= a && e <= b)
		return st[k];
	if(s >= b || e <= a)
		return -1;
	int mid = (s+e)/2;
	int v1 = q(2*k,s,mid,a,b);
	int v2 = q(2*k+1,mid,e,a,b);

	if(v1 == -1)
		return v2;
	else if(v2 == -1)
		return v1;

	if(c[v1] <= c[v2])
		return v1;
	return v2;
}

int main() {
	int n,m;
	scanf("%d",&m);
	scanf("%s",c);
	n = strlen(c);
	b(1,0,n);
	int last = q(1,0,n,0,m);
	char l = c[last];
	vis[last] = 1;
	fore(i,1,n-m+1) {
		int v1 = q(1,0,n,i,i+m);
		if(c[v1] == l && i <= last)
			continue;
		vis[v1] = 1;
		last = v1;
		l = c[v1];

	}
	vector<char> ans;
	fore(i,0,N)
		if(vis[i])
			ans.pb(c[i]);
	sort(ans.begin(),ans.end());
	char w = c[ans.size()-1];
	int h = n-1;
	while(h >= 0) {
		if(c[h] != w) {
			h--;
			continue;
		}
		for(int i=h-1;i>=max(0,h-m+1);i--)
			if(vis[i] && c[i] == w)
				vis[i] = 0;
		h -=m;
	}
	ans.clear();
	fore(i,0,N)
		if(vis[i])
			ans.pb(c[i]);
	sort(ans.begin(),ans.end());
	bool fa = 1;
	fore(i,0,ans.size())
		if(ans[i] != ans[0])
			fa = 0;
	if(fa) {
		ans.clear();
		int last;
		for(int i=m-1;i>=0;i--)
			if(vis[i]) {
				last = i;
				break;
			}
		ans.pb(c[last]);
		fore(i,1,n-m+1)
			if(last >= i)
				continue;
			else {
				for(int j=i+m-1;j>=i;j--)
					if(vis[j]) {
						last = j;
						break;
					}
				ans.pb(c[last]);
			}
	}
	fore(i,0,ans.size())
		c[i] = ans[i];
	c[(int)ans.size()] = '\0';
	printf("%s\n",c);
}


#include <bits/stdc++.h>
#define pb push_back
#define mp make_pair
#define fst first
#define snd second
#define fore(i,a,b) for(int i=a,to=b;i<to;++i)
#define mod 1000000009
using namespace std;

typedef long long ll;
typedef pair<int,int> ii;
const int N = 510500;
char c[N],t;
int n,vis[N],m;
bool ok() {
	int l = 0;
	fore(i,0,n) {
		if(c[i] > t)
			l++;
		else
			l=0;
		if(l == m)
			return 0;
	}
	return 1;
}
int main(){
	scanf("%d",&m);
	scanf("%s",c);
	n = strlen(c);
	for(t = 'a';t<='z';t++) if(ok()) break;

	int l = 0,last = -1;
	vector<char> ans;
	fore(i,0,n) {
		if(c[i] > t)
			l++;
		else if(c[i] == t) {
			l++;
			last = i;
		} else {
			l = 0;
			last = i;
			ans.pb(c[i]);
		}
		if(l == m) {
			l = last-i;
			ans.pb(t+1);
		}
	}
	sort(ans.begin(),ans.end());
	fore(i,0,ans.size())
		putchar(ans[i]);
	puts("");
	return 0;
}


#include <bits/stdc++.h>
#define fore(i,a,n) for(int i=a;i<n;i++)
#define pb push_back
#define mp make_pair
#define endl '\n'
#define EPS 1e-12
#define fst first
#define snd second
using namespace std;

typedef long long ll;
typedef pair<int,int> ii;
const int N = 100505;
const ll mod = (ll) 1e9 + 7;
int st[4*N];
char c[N];
int q[N];
vector<char> ans;
int main() {
	int n,m;
	scanf("%d",&m);
	scanf("%s",c);
	char w = 'z';
	n = strlen(c);
	int k = 1,last = -1;
	fore(i,0,m)
		if(c[i] <= w) {
			w = c[i];
			last = i;
		}
	ans.pb(w);
	while(k<n-m+1) {
		if(last < k)
			last = k,w = c[k];
		fore(j,last,k+m) {
			if(c[j] <= w) {
				w = c[j];
				last = j;
			}
		}
		k++;
		ans.pb(w);
	}
	sort(ans.begin(),ans.end());
	bool f = ans[0] == ans[ans.size()-1];
	w = ans[ans.size()-1];
	if(f) {
		w++;
	}
	ans.clear();
	k = 0;
	bool s = 0;
	q[1] = (c[0] < w);
	fore(i,2,n)
		q[i] = q[i-1] +( c[i-1]<w);
	last = -1;
	while(k < n-m+1) {
		if(c[k] < w)
			last = max(k,last);
		else if(k >= last){
			if(q[k+m]-q[k] == 0) {
				ans.pb(w);
				last = k+m;
			}
		}
		k++;
	}
	fore(i,0,n)
		if(c[i] < w)
			ans.pb(c[i]);
	sort(ans.begin(),ans.end());
	fore(i,0,ans.size())
		c[i] = ans[i];
	c[ans.size()] = '\0';
	printf("%s\n",c);

}


#include <bits/stdc++.h>
#define fore(i,a,n) for(int i=a;i<n;i++)
#define pb push_back
#define mp make_pair
#define endl '\n'
#define EPS 1e-12
#define fst first
#define snd second
using namespace std;

typedef long long ll;
typedef pair<int,int> ii;
const int N = 100505;
const ll mod = (ll) 1e9 + 7;
int st[4*N];
char c[N];
bool vis[N];
void b(int k, int s, int e) {
	if(s+1==e) {
		st[k] = s;
		return;
	}
	int mid = (s+e)/2;
	b(2*k,s,mid);
	b(2*k+1,mid,e);
	if(c[st[2*k]] < c[st[2*k+1]]) {
		st[k] = st[2*k];
		return;
	}
	st[k] = st[2*k+1];
	return;
}
int q(int k, int s, int e, int a, int b) {
	if(s >= a && e <= b)
		return st[k];
	if(s >= b || e <= a)
		return -1;
	int mid = (s+e)/2;
	int v1 = q(2*k,s,mid,a,b);
	int v2 = q(2*k+1,mid,e,a,b);

	if(v1 == -1)
		return v2;
	else if(v2 == -1)
		return v1;

	if(c[v1] < c[v2])
		return v1;
	return v2;
}

int main() {
	int n,m;
	scanf("%d",&m);
	scanf("%s",c);
	n = strlen(c);
	b(1,0,n);
	int last = q(1,0,n,0,m);
	char l = c[last];
	vis[last] = 1;
	fore(i,1,n) {
		int v1 = q(1,0,n,i,min(i+m,n));
		if(c[v1] == l && i <= last)
			continue;
		vis[v1] = 1;
		last = v1;
		l = c[v1];

	}
	vector<char> ans;
	fore(i,0,N)
		if(vis[i])
			ans.pb(c[i]);
	sort(ans.begin(),ans.end());
	fore(i,0,ans.size())
		c[i] = ans[i];
	c[(int)ans.size()] = '\0';
	printf("%s\n",c);
}


#include <bits/stdc++.h>
#define fore(i,a,n) for(int i=a;i<n;i++)
#define pb push_back
#define mp make_pair
#define endl '\n'
#define EPS 1e-12
#define fst first
#define snd second
using namespace std;

typedef long long ll;
typedef pair<int,int> ii;
const int N = 100505;
const ll mod = (ll) 1e9 + 7;
int st[4*N];
char c[N];
int q[N];
vector<char> ans;
int main() {
	int n,m;
	scanf("%d",&m);
	scanf("%s",c);
	char w = 'z';
	n = strlen(c);
	int k = 1,last = -1;
	fore(i,0,m)
		if(c[i] <= w) {
			w = c[i];
			last = i;
		}
	ans.pb(w);
	while(k<n-m+1) {
		if(last < k)
			last = k,w = c[k];
		fore(j,last,k+m) {
			if(c[j] <= w) {
				w = c[j];
				last = j;
			}
		}
		k++;
		ans.pb(w);
	}
	sort(ans.begin(),ans.end());
	bool f = ans[0] == ans[ans.size()-1];
	w = ans[ans.size()-1];
	if(f) {
		fore(i,0,(n)/m)
			putchar(w);
		puts("");
		return 0;
	}
	ans.clear();
	k = 0;
	bool s = 0;
	q[1] = (c[0] < w);
	fore(i,2,n)
		q[i] = q[i-1] +( c[i-1]<w);
	last = -1;
	while(k < n-m+1) {
		if(c[k] < w)
			last = max(k,last);
		else if(k > last){
			if(q[k+m]-q[k] == 0) {
				ans.pb(w);
				last = k+m+1;
			}
		}
		k++;
	}
	fore(i,0,n)
		if(c[i] < w)
			ans.pb(c[i]);
	sort(ans.begin(),ans.end());
	fore(i,0,ans.size())
		c[i] = ans[i];
	c[ans.size()] = '\0';
	printf("%s\n",c);

}


/*
*/
#include <iostream>
using namespace std;
#include <string>
#include <algorithm>
long int m,s[200]={0},ok=0;
string str;
int main(){
	cin>>m;
	cin>>str;
	for(char chr='a';chr<='z';chr++){
		int i=0;
		while(1){
			if(i+m>=str.length())goto end;
			ok=false;
			for(int j=i+m-1;j>=i;j--){
				if(str[j]<chr){
					i=j+1;
					ok=true;
					goto t1;
				};
			};
			for(int j=i+m-1;j>=i;j--){
				if(str[j]==chr){
					i=j+1;
					s[chr]++;
					ok=true;
					break;
				};
			};
	t1:		if(!ok){
				s[chr]=0;
				for(int j=0;j<str.length();j++)
					if(str[j]==chr){
						s[chr]++;
					};
				break;
			};
		};
	};
end:for(char chr='a';chr<='z';chr++){
		for(int i=0;i<s[chr];i++)
	//		cout<<chr;
	};
};


/*
ע����ǵ�һ���н�str.length()ת��Ϊint���ͣ�������unsigned int������ת���ͻ����
*/
#include <iostream>
using namespace std;
#include <string>
#include <algorithm>
long int m,s[200]={0},ok=0;
string str;
int main(){
	cin>>m;
	cin>>str;
	for(char chr='a';chr<='z';chr++){
		int i=0;
		while(1){
			if(i+m>=(int)str.length())goto end;/*�ҵ�����*/
			ok=false;
			for(int j=i+m-1;j>=i;j--){
				if(str[j]<chr){
					i=j+1;
					ok=true;
					goto t1;
				};
			};
			for(int j=i+m-1;j>=i;j--){
				if(str[j]==chr){
					i=j+1;
					s[chr]++;
					ok=true;
					break;
				};
			};
	t1:		if(!ok){
				s[chr]=0;
				for(int j=0;j<(int)str.length();j++)
					if(str[j]==chr){
						s[chr]++;
					};
				break;
			};
		};
	};
end:for(char chr='a';chr<='z';chr++){
		for(int i=0;i<s[chr];i++)
			cout<<chr;
	};
};


/*
 */
#include <iostream>
using namespace std;
#include <string>
#include <algorithm>
long int m,s[200]={0},ok=0;
string str;
int main(){
	cin>>m;
	cin>>str;
	for(char chr='a';chr<='z';chr++){
		int i=0;
		while(1){
			if(i+m>str.length())goto end;
			ok=false;
			for(int j=i+m-1;j>=i;j--){
				if(str[j]<chr){
					i=j+1;
					ok=true;
					goto t1;
				};
			};
			for(int j=i+m-1;j>=i;j--){
				if(str[j]==chr){
					i=j+1;
					s[chr]++;
					ok=true;
					break;
				};
			};
	t1:		if(!ok){
				s[chr]=0;
				for(int j=0;j<str.length();j++)
					if(str[j]==chr){
						s[chr]++;
					};
				break;
			};
		};
	};
end:for(char chr='a';chr<='z';chr++){
		for(int i=0;i<s[chr];i++)
			cout<<chr;
	};
};


#include <iostream>
using namespace std;
#include <string>
#include <algorithm>
long int m,s[200]={0},ok=0;
string str;
int main(){
	cin>>m;
	cin>>str;
	for(char chr='a';chr<='z';chr++){
		int i=0;
		while(1){
			if(i+m>=str.length())goto end;
			ok=false;
			for(int j=i+m-1;j>=i;j--){
				if(str[j]<chr){
					i=j+1;
					ok=true;
					goto t1;
				};
			};
			for(int j=i+m-1;j>=i;j--){
				if(str[j]==chr){
					i=j+1;
					s[chr]++;
					ok=true;
					break;
				};
			};
	t1:		if(!ok){
				s[chr]=0;
				for(int j=0;j<str.length();j++)
					if(str[j]==chr){
						s[chr]++;
					};
				break;
			};
		};
	};
end:for(char chr='a';chr<='z';chr++){
		for(int i=0;i<s[chr];i++)
			cout<<chr;
	};
};


#include <iostream>
using namespace std;
#include <string>
#include <algorithm>
long int m,s[200]={0},ok=0;
string str;
int main(){
	cin>>m;
	cin>>str;
	for(char chr='a';chr<='z';chr++){
		if(m==100000)cout<<chr<<"  ";
		int i=0;
		while(1){
			if(i+m>=(int)str.length())goto end;
			if(m==100000)cout<<"past i="<<i<<endl;
			ok=false;
			for(int j=i+m-1;j>=i;j--){
				if(str[j]<chr){
					i=j+1;
					ok=true;
					goto t1;
				};
			};
			for(int j=i+m-1;j>=i;j--){
				if(str[j]==chr){
					i=j+1;
					if(m==100000)cout<<"now j="<<j<<endl;
					s[chr]++;
					ok=true;
					break;
				};
			};
	t1:		if(!ok){
				s[chr]=0;
				for(int j=0;j<(int)str.length();j++)
					if(str[j]==chr){
						s[chr]++;
					};
				break;
			};
		};
	};
end:for(char chr='a';chr<='z';chr++){
		for(int i=0;i<s[chr];i++)
			cout<<chr;
	};
};


#include <iostream>
using namespace std;
#include <string>
#include <algorithm>
int m,s[200]={0},ok=0,used[200]={0};
string str;
int main(){
	cin>>m;
	cin>>str;
	for(char chr='a';chr<='z';chr++){
//		cout<<"starting check "<<chr<<endl;
		int i=0;
		while(1){
			if(i+m>=str.length())goto end;
//			cout<<"past i="<<i<<endl;
			ok=false;
			for(int j=i+m-1;j>=i;j--){
				if(str[j]<chr){
					i=j+1;
					ok=true;
					goto t1;
				};
			};
			for(int j=i+m-1;j>=i;j--){
				if(str[j]==chr){
					i=j+1;
//					cout<<"now j="<<j<<endl;
					s[chr]++;
					ok=true;
					break;
				};
			};
	t1:		if(!ok){
				s[chr]=0;
				for(int j=0;j<str.length();j++)
					if(str[j]==chr){
						s[chr]++;
					};
				break;
			};
		};
	};
end:for(char chr='a';chr<='z';chr++){
		for(int i=0;i<s[chr];i++)
			cout<<chr;
	};
};


#include <iostream>
using namespace std;
#include <string>
#include <algorithm>
long int m,s[200]={0},ok=0;
string str;
int main(){
	cin>>m;
	cin>>str;
	for(char chr='a';chr<='z';chr++){
		if(m==100000)cout<<chr<<"  ";
		int i=0;
		while(1){
			if(i+m>=str.length())goto end;
			if(m==100000)cout<<"past i="<<i<<endl;
			ok=false;
			for(int j=i+m-1;j>=i;j--){
				if(str[j]<chr){
					i=j+1;
					ok=true;
					goto t1;
				};
			};
			for(int j=i+m-1;j>=i;j--){
				if(str[j]==chr){
					i=j+1;
					if(m==100000)cout<<"now j="<<j<<endl;
					s[chr]++;
					ok=true;
					break;
				};
			};
	t1:		if(!ok){
				s[chr]=0;
				for(int j=0;j<str.length();j++)
					if(str[j]==chr){
						s[chr]++;
					};
				break;
			};
		};
	};
end:for(char chr='a';chr<='z';chr++){
		for(int i=0;i<s[chr];i++)
			cout<<chr;
	};
};


#include <iostream>
using namespace std;
#include <string>
#include <algorithm>
int m,s[200]={0},ok=0,used[200]={0};
string str;
int main(){
	cin>>m;
	cin>>str;
	for(char chr='a';chr<='z';chr++){
//		cout<<"starting check "<<chr<<endl;
		int i=0;
		while(1){
			if(i+m>=str.length())goto end;
//			cout<<"past i="<<i<<endl;
			ok=false;
			for(int j=i+m-1;j>=i;j--){
				if(str[j]==chr){
					i=j+1;
//					cout<<"now j="<<j<<endl;
					s[chr]++;
					ok=true;
					break;
				};
				if(str[j]<chr){
					i=j+1;
					ok=true;
					break;
				};
			};
			if(!ok){
				s[chr]=0;
				for(int j=0;j<str.length();j++)
					if(str[j]==chr){
						s[chr]++;
					};
				break;
			};
		};
	};
end:for(char chr='a';chr<='z';chr++){
		for(int i=0;i<s[chr];i++)
			cout<<chr;
	};
};


/*
*/
#include <iostream>
using namespace std;
#include <string>
#include <algorithm>
long int m,s[200]={0},ok=0;
string str;
int main(){
	cin>>m;
	cin>>str;
	for(char chr='a';chr<='z';chr++){
		int i=0;
		while(1){
			if(i+m>=str.length())goto end;
			ok=false;
			for(int j=i+m-1;j>=i;j--){
				if(str[j]<chr){
					i=j+1;
					ok=true;
					goto t1;
				};
			};
			for(int j=i+m-1;j>=i;j--){
				if(str[j]==chr){
					i=j+1;
					s[chr]++;
					ok=true;
					break;
				};
			};
	t1:		if(!ok){
				s[chr]=0;
				for(int j=0;j<str.length();j++)
					if(str[j]==chr){
						s[chr]++;
					};
				break;
			};
		};
	};
end:for(char chr='a';chr<='z';chr++){
		for(int i=0;i<s[chr];i++);
	//		cout<<chr;
	};
};


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

#define fi(i,a,b)   for(long long i=a;i<=b;i++)
#define fr(i,a)     for(long long i=0;i<a;i++)
#define fd(i,a,b)   for(long long i=b;i>=a;i--)
#define clr(x)      memset(x,0,sizeof(x))
#define cln(x)      memset(x,-1,sizeof(x))
#define __          printf(" ")
#define _           printf("\n")
#define stree       long long lft=node<<1,rht=(node<<1)|1,mid=(s+e)>>1

deque<long long>d;
char ch[100010];
long long len=-1,m;

long long In_SRMQ(long long cur){
    while(len>=0){
        if(ch[d[len]]>=ch[cur]) {
            len--;
            d.pop_back();
        }
        else {
                d.push_back(cur);
                len++;
                break;
        }
    }
    if(len<0){
        d.push_back(cur);
        len++;
    }
    while(d[0]<cur-m+1){
        d.pop_front();
        len--;
    }
    return d[0];
}

main(){
    scanf("%lld",&m);
    scanf("%s",ch);
    long long sLen=strlen(ch),t[30],mem[30],cur=26,pre=-1,pp;
    clr(t),clr(mem);

    fr(i,sLen) t[ch[i]-'a']++;
    fi(i,1,m-1) In_SRMQ(i-1);
    fi(i,m,sLen) {
        pp=In_SRMQ(i-1);

        if(pp!=pre) {
               if(pre!=-1){
                   if(i-m<=pre) if(ch[pp]==ch[pre]) continue;
               }
                mem[ch[pp]-'a']++;
                pre=pp;
        }
    }

    while(cur--) if(mem[cur]){
                    t[cur]=mem[cur];
                    break;
                 }

    fi(i,0,cur) while(t[i]--) printf("%c",char(i+'a'));
    _;

    return 0;
}


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

#define fi(i,a,b)   for(long long i=a;i<=b;i++)
#define fr(i,a)     for(long long i=0;i<a;i++)
#define fd(i,a,b)   for(long long i=b;i>=a;i--)
#define clr(x)      memset(x,0,sizeof(x))
#define cln(x)      memset(x,-1,sizeof(x))
#define __          printf(" ")
#define _           printf("\n")
#define stree       long long lft=node<<1,rht=(node<<1)|1,mid=(s+e)>>1

deque<long long>d;
char ch[100010];
long long len=-1,m;

long long In_SRMQ(long long cur){
    while(len>=0){
        if(ch[d[len]]>=ch[cur]) {
            len--;
            d.pop_back();
        }
        else {
                d.push_back(cur);
                len++;
                break;
        }
    }
    if(len<0){
        d.push_back(cur);
        len++;
    }
    while(d[0]<cur-m+1){
        d.pop_front();
        len--;
    }
    return d[0];
}

main(){
    scanf("%lld",&m);
    scanf("%s",ch);
    long long sLen=strlen(ch),t[30],mem[30],cur=26,pre=-1,pp;
    clr(t),clr(mem);

    fr(i,sLen) t[ch[i]-'a']++;
    fi(i,1,m-1) In_SRMQ(i-1);
    fi(i,m,sLen) {
        pp=In_SRMQ(i-1);

        if(pp!=pre) {
               if(pre!=-1){
                   if(pp-m+1<=pre) if(ch[pp]==ch[pre]) continue;
               }
                mem[ch[pp]-'a']++;
                pre=pp;
        }
    }

    while(cur--) if(mem[cur]){
                    t[cur]=mem[cur];
                    break;
                 }

    fi(i,0,cur) while(t[i]--) printf("%c",char(i+'a'));
    _;

    return 0;
}


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

#define fi(i,a,b)   for(long long i=a;i<=b;i++)
#define fr(i,a)     for(long long i=0;i<a;i++)
#define fd(i,a,b)   for(long long i=b;i>=a;i--)
#define clr(x)      memset(x,0,sizeof(x))
#define cln(x)      memset(x,-1,sizeof(x))
#define __          printf(" ")
#define _           printf("\n")
#define stree       long long lft=node<<1,rht=(node<<1)|1,mid=(s+e)>>1

deque<long long>d;
char ch[100010];
long long len=-1,m;

long long In_SRMQ(long long cur){
    while(len>=0){
        if(ch[d[len]]>=ch[cur]) {
            len--;
            d.pop_back();
        }
        else {
                d.push_back(cur);
                len++;
                break;
        }
    }
    if(len<0){
        d.push_back(cur);
        len++;
    }
    while(d[0]<cur-m+1){
        d.pop_front();
        len--;
    }
    return d[0];
}

main(){
    scanf("%lld",&m);
    scanf("%s",ch);
    long long sLen=strlen(ch),t[30],mem[30],cur=26;
    clr(t),clr(mem);

    fr(i,sLen) t[ch[i]-'a']++;
    fi(i,1,m-1) In_SRMQ(i-1);
    fi(i,m,sLen) mem[ch[In_SRMQ(i-1)]-'a']++;

    while(cur--) if(mem[cur]){
                    t[cur]=mem[cur];
                    break;
                 }

    fi(i,0,cur) while(t[i]--) printf("%c",char(i+'a'));
    _;

    return 0;
}


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

#define fi(i,a,b)   for(long long i=a;i<=b;i++)
#define fr(i,a)     for(long long i=0;i<a;i++)
#define fd(i,a,b)   for(long long i=b;i>=a;i--)
#define clr(x)      memset(x,0,sizeof(x))
#define cln(x)      memset(x,-1,sizeof(x))
#define __          printf(" ")
#define _           printf("\n")
#define stree       long long lft=node<<1,rht=(node<<1)|1,mid=(s+e)>>1

deque<long long>d;
char ch[100010];
long long len=-1,m;

long long In_SRMQ(long long cur){
    while(len>=0){
        if(ch[d[len]]>=ch[cur]) {
            len--;
            d.pop_back();
        }
        else {
                d.push_back(cur);
                len++;
                break;
        }
    }
    if(len<0){
        d.push_back(cur);
        len++;
    }
    while(d[0]<cur-m+1){
        d.pop_front();
        len--;
    }
    return d[0];
}

main(){
    scanf("%lld",&m);
    scanf("%s",ch);
    long long sLen=strlen(ch),t[30],mem[30],cur=26,pre,pp;
    clr(t),clr(mem);

    fr(i,sLen) t[ch[i]-'a']++;
    fi(i,1,m-1) In_SRMQ(i-1);
    fi(i,m,sLen) {
        pp=In_SRMQ(i-1);
        if(pp!=pre) {
                mem[ch[pp]-'a']++;
                pre=pp;
        }
    }

    while(cur--) if(mem[cur]){
                    t[cur]=mem[cur];
                    break;
                 }

    fi(i,0,cur) while(t[i]--) printf("%c",char(i+'a'));
    _;

    return 0;
}


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

#define fi(i,a,b)   for(long long i=a;i<=b;i++)
#define fr(i,a)     for(long long i=0;i<a;i++)
#define fd(i,a,b)   for(long long i=b;i>=a;i--)
#define clr(x)      memset(x,0,sizeof(x))
#define cln(x)      memset(x,-1,sizeof(x))
#define __          printf(" ")
#define _           printf("\n")
#define stree       long long lft=node<<1,rht=(node<<1)|1,mid=(s+e)>>1

deque<long long>d;
char ch[100010];
long long len=-1,m;

long long In_SRMQ(long long cur){
    while(len>=0){
        if(ch[d[len]]>ch[cur]) {
            len--;
            d.pop_back();
        }
        else {
                d.push_back(cur);
                len++;
                break;
        }
    }
    if(len<0){
        d.push_back(cur);
        len++;
    }
    while(d[0]<cur-m+1){
        d.pop_front();
        len--;
    }
    return d[0];
}

main(){
    scanf("%lld",&m);
    scanf("%s",ch);
    long long sLen=strlen(ch),t[30],mem[30],cur=26,pre=-1,pp;
    clr(t),clr(mem);

    fr(i,sLen) t[ch[i]-'a']++;
    fi(i,1,m-1) In_SRMQ(i-1);
    fi(i,m,sLen) {
        pp=In_SRMQ(i-1);
        if(pp!=pre) {
                mem[ch[pp]-'a']++;
                pre=pp;
        }
    }

    while(cur--) if(mem[cur]){
                    t[cur]=mem[cur];
                    break;
                 }

    fi(i,0,cur) while(t[i]--) printf("%c",char(i+'a'));
    _;

    return 0;
}


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

#define fi(i,a,b)   for(long long i=a;i<=b;i++)
#define fr(i,a)     for(long long i=0;i<a;i++)
#define fd(i,a,b)   for(long long i=b;i>=a;i--)
#define clr(x)      memset(x,0,sizeof(x))
#define cln(x)      memset(x,-1,sizeof(x))
#define __          printf(" ")
#define _           printf("\n")
#define stree       long long lft=node<<1,rht=(node<<1)|1,mid=(s+e)>>1

deque<long long>d;
char ch[100010];
long long len=-1,m;

long long In_SRMQ(long long cur){
    while(len>=0){
        if(ch[d[len]]>=ch[cur]) {
            len--;
            d.pop_back();
        }
        else {
                d.push_back(cur);
                len++;
                break;
        }
    }
    if(len<0){
        d.push_back(cur);
        len++;
    }
    while(d[0]<cur-m+1){
        d.pop_front();
        len--;
    }
    return d[0];
}

main(){
    scanf("%lld",&m);
    scanf("%s",ch);
    long long sLen=strlen(ch),t[30],mem[30],cur=26,pre=-1,pp;
    clr(t),clr(mem);

    fr(i,sLen) t[ch[i]-'a']++;
    fi(i,1,m-1) In_SRMQ(i-1);
    fi(i,m,sLen) {
        pp=In_SRMQ(i-1);
        if(pp!=pre) {
                mem[ch[pp]-'a']++;
                pre=pp;
        }
    }

    while(cur--) if(mem[cur]){
                    t[cur]=mem[cur];
                    break;
                 }

    fi(i,0,cur) while(t[i]--) printf("%c",char(i+'a'));
    _;

    return 0;
}


#include <bits/stdc++.h>
using namespace std;
typedef long long ll;
typedef pair<ll  ,ll  > ii;
ll tree[200005],MaxVal;
vector<ii> v;
ll read(ll idx){
    ll sum = 0;
    while (idx > 0){
        sum += tree[idx];
        idx -= (idx & -idx);
    }
    return sum;
}
void update(ll idx ,ll val){
    while (idx <= MaxVal){
        tree[idx] += val;
        idx += (idx & -idx);
    }
}
int  main()
{
 //   freopen("in","r",stdin);
  ios::sync_with_stdio(false),cin.tie(0),cout.tie(0);
  int m;
  memset(tree,0,sizeof tree);
  string s;
  cin>>m>>s;
  for(int i=0;i<s.size();i++)
  {
      v.push_back(ii(s[i],i+2));
  }
  MaxVal=s.size()+1;
  string ans="";
  sort(v.begin(),v.end());
  for(int i=0;i<v.size();i++){
      if(read(min(MaxVal,v[i].second+m-1))-read(v[i].second)==0)
          if(read(min(MaxVal,v[i].second+m-1))-read(min(MaxVal,v[i].second+m-1)-m)==0){
          ans+=v[i].first;

      //cout<<read(min(MaxVal,v[i].second+m-1))-read(min(MaxVal,v[i].second+m-1)-m+1)<<endl;
          update(v[i].second,(ll)1);

      continue;}
      if(read(v[i].second)-read(max((ll)1,v[i].second-m))==0)
          if(read(max((ll)2,v[i].second-m+1)+m-1)-read(max((ll)1,v[i].second-m))==0)
          {   ans+=v[i].first; update(v[i].second,(ll)1);continue;}

  }
  cout<<ans;
}


#include <bits/stdc++.h>
using namespace std;
string joub="";
bool mozar[100005];
int n;
string s;
int main()
{
//freopen("in","r",stdin);
ios::sync_with_stdio(false),cin.tie(0),cout.tie(0);
cin>>n;
        cin>>s;
        memset(mozar,0,sizeof mozar);
        char c='{';
        int ind=0;
        char bigchaar='A';
        int indforin=0;
        for(int i=0;i<s.size();){
            indforin=i;
            c='{';
            ind=0;
            if(i+n>s.size())break;
            for(int j=0;j<n && i+j<s.size();++j){
                if(s[i+j]<=c ){
                    ind=i+j;
                    c=s[i+j];
                }
            }
            if(!mozar[ind])joub+=c;
            bigchaar=max(bigchaar,c);
            mozar[ind]=1;
            i=ind;
            if(i==indforin)i++;

        }
        for(int i=0;i<s.size();++i){
            if(s[i]<bigchaar && !mozar[i]){
                joub+=s[i];
            }
        }

        // deff
        sort(joub.begin(),joub.end());
        cout<<joub<<endl;

        return 0;
    }


#include <bits/stdc++.h>
using namespace std;
typedef long long ll;
typedef pair<char  ,ll  > ii;
ll tree[200005],MaxVal;
ll cnt1[27],cnt2[27];
bool vis [27];
vector<ii> v;
ll read(ll idx){
    ll sum = 0;
    while (idx > 0){
        sum += tree[idx];
        idx -= (idx & -idx);
    }
    return sum;
}
void update(ll idx ,ll val){
    while (idx <= MaxVal){
        tree[idx] += val;
        idx += (idx & -idx);
    }
}
int  main()
{
  //  freopen("in","r",stdin);
  ios::sync_with_stdio(false),cin.tie(0),cout.tie(0);
  int m;
  memset(tree,0,sizeof tree);
  string s;
  cin>>m>>s;
  for(int i=0;i<s.size();i++)
  {
      v.push_back(ii(s[i],i+2));
  }
  for(int i=0;i<s.size();i++)
      cnt2[s[i]-'a']++;
  string ans="";

  MaxVal=s.size()+1;
    sort(v.begin(),v.end());
  int i;
  for( i=v.size()-1;i>0;i--)
      if(v[i].first!=v[i-1].first)
          break;
  for(int j=0;j<v.size();j++){
      update(v[j].second,(ll)1);
  }
  bool b=1;
  int yy=s.size()-1;
  update((ll)1,(ll)1);
  char c=v[v.size()-1].first;
  for(i=v.size()-1;i>=-1;i--)
  {yy=i;if(i<0)
      break;
      ;vis[v[i].first-'a']=1;

      if(v[i].second==MaxVal)
          if(read(v[i].second-1)-read(max(v[i].second-m,(ll)1))==0)
              {if(b){b=0;c=v[i].first;}ans+=v[i].first;continue;}
          else
              {
              bool cur=0;
          for(int k=0;k<26;k++){if(cur)
              break;
              if(vis[k] && v[i].first-'a'!=k)
                  if(cnt1[k]!=cnt2[k])
                      cur=1;}
      if(cur)
          break;
          update(v[i].second,-1); cnt1[v[i].first-'a']++;
      }
      else
//      cout<<read(v[i].second-1)-read(max(v[i].second-m,(ll)1))<<endl;
//      cout<<read(min(MaxVal,v[i].second+m-1))-read(min(MaxVal,v[i].second))<<endl;
      if(read(max(v[i].second-m,(ll)1)+m)-read(max(v[i].second-m,(ll)1))-1==0 || read(min(MaxVal,v[i].second+m-1))-read(min(MaxVal,v[i].second+m-1)-m)-1==0)

      {if(b){b=0;c=v[i].first;}ans+=v[i].first;continue;}
      else
      { bool cur=0;
          for(int k=0;k<26;k++){if(cur)
              break;
              if(vis[k] && v[i].first-'a'!=k)
                  if(cnt1[k]!=cnt2[k])
                      cur=1;}
      if(cur)
          break;
          update(v[i].second,-1);
          cnt1[v[i].first-'a']++;
      }
  }
   for(int i=0;i<=yy;i++)
      cout<<(char)v[i].first;
  for(int i=ans.size()-1;i>=0;i--)
  cout<<ans[i];

  return 0;
}


#include <bits/stdc++.h>
using namespace std;
typedef long long ll;
typedef pair<char  ,ll  > ii;
typedef pair<ii  ,ll  > iii;
ll tree[200005],MaxVal;
vector<iii> v;
ll read(ll idx){
    ll sum = 0;
    while (idx > 0){
        sum += tree[idx];
        idx -= (idx & -idx);
    }
    return sum;
}
void update(ll idx ,ll val){
    while (idx <= MaxVal){
        tree[idx] += val;
        idx += (idx & -idx);
    }
}
int  main()
{
    //freopen("in","r",stdin);
  ios::sync_with_stdio(false),cin.tie(0),cout.tie(0);
  int m;
  memset(tree,0,sizeof tree);
  string s;
  cin>>m>>s;
  for(int i=0;i<s.size();i++)
  {
      v.push_back(iii(ii(s[i],m-i%m),i+2));
  }
  MaxVal=s.size()+1;
  string ans="";
  sort(v.begin(),v.end());
  for(int i=0;i<v.size();i++){
      if(read(min(MaxVal,v[i].second+m-1))-read(v[i].second)==0)
          if(read(min(MaxVal,v[i].second+m-1))-read(min(MaxVal,v[i].second+m-1)-m)==0){
          ans+=v[i].first.first;

      //cout<<read(min(MaxVal,v[i].second+m-1))-read(min(MaxVal,v[i].second+m-1)-m+1)<<endl;
          update(v[i].second,(ll)1);

      continue;}
      if(read(v[i].second)-read(max((ll)1,v[i].second-m))==0)
          if(read(max((ll)2,v[i].second-m+1)+m-1)-read(max((ll)1,v[i].second-m))==0)
          {   ans+=v[i].first.first; update(v[i].second,(ll)1);continue;}

  }
  cout<<ans;
}


#include <bits/stdc++.h>
using namespace std;
typedef pair<char ,int > ii;
typedef long long ll;
bool vis[200005];
int  main()
{
  //  freopen("in","r",stdin);
  ios::sync_with_stdio(false),cin.tie(0),cout.tie(0);
  int m,ind=0;
  string s,ans="";
  cin>>m>>s;
  char c=s[0];
  for(int i=0;i<m;i++)
      if(s[i]<=c){
          c=s[i];
          ind=i;
      }
  char sol=c;;
  int indc=ind;
  indc=ind=-1;
//  ans+=c;
//  vis[indc]=1;
  sol='z'+1;
  int i=1;
  bool b=true;
  while(b){
      if(ind+m>=s.size())
          break;
  for(int i=1;i<=m;i++)
  {
      if(i==1)
          sol='z'+1;
      if(i+ind>=s.size()){
          b=0;
      }
              if(i+ind<s.size() && sol>=s[i+ind]){
                  sol=s[i+ind];
              indc=ind+i;}
 }
              ind=indc;
              ans+=s[indc];
              vis[indc]=1;
  }
  string ans1="";
  sort(ans.begin(),ans.end());
  for(int i=0;i<s.size();i++)
      if(s[i]<ans[ans.size()-1]&&!vis[i])
          ans1+=s[i];
  for(int i=0;i<ans1.size();i++)
      ans+=ans1[i];
   sort(ans.begin(),ans.end());
   cout<<ans;

  return 0;
}


#include <iostream>
#include <cstdio>
#include <ctime>
#include <vector>
#include <algorithm>
#include <cmath>
#include <cstring>

#define rep(i,a,b) for(int i=(a),_b=(b);i<_b;i++)
#define repn(i,a,b) for(int i=(a),_b=(b);i<=_b;i++)
#define pern(i,b,a) for(int i=(b),_a=(a);i>=_a;i--)
#define fi first
#define se second
#define pb push_back
#define mp make_pair
#define sqr(i) 1ll*i*i
#define sz(x) int((x).size())

using namespace std;

typedef long long ll;
typedef unsigned long long ull;
typedef pair<int, int> pii;
typedef vector<int> vi;
typedef vector<pii> vii;

const int maxn = 100010;

int m;
string s;
int a[maxn];
char mx;
string ans;

void input(){
	scanf("%d\n",&m);
	getline(cin, s);
}

void solve(){
	for(int i = 0; i <= s.length()-m; i++){
		int k = i;
		for(int j = i; j < i + m; j++)
			if (s[j] <= s[k]) k = j;
		ans = ans + s[k];
		a[k] = 1;
		mx = max(mx, s[k]);
		i = k;
	}

	for(int i = 0; i < s.length(); i++){
		if (s[i] < mx && !a[i]) ans = ans + s[i];
	}

	sort(ans.begin(), ans.end());
	puts(ans.c_str());
}

int main(){
	clock_t timestart, timeend;
	timestart = clock();
//	freopen("input.inp","r",stdin);
//	freopen("output.out","w",stdout);
	input();
	solve();
	timeend = clock();
	//system("pause");
	//printf("\nRun time : %lf",(timeend-timestart)*1.0/CLK_TCK);
	return 0;
}


#include <iostream>
#include <cstdio>
#include <ctime>
#include <vector>
#include <algorithm>
#include <cmath>
#include <cstring>

#define rep(i,a,b) for(int i=(a),_b=(b);i<_b;i++)
#define repn(i,a,b) for(int i=(a),_b=(b);i<=_b;i++)
#define pern(i,b,a) for(int i=(b),_a=(a);i>=_a;i--)
#define fi first
#define se second
#define pb push_back
#define mp make_pair
#define sqr(i) 1ll*i*i
#define sz(x) int((x).size())

using namespace std;

typedef long long ll;
typedef unsigned long long ull;
typedef pair<int, int> pii;
typedef vector<int> vi;
typedef vector<pii> vii;

const int maxn = 100010;

int m;
string s;
int a[maxn];
char mx;
string ans;

void input(){
	scanf("%d\n",&m);
	getline(cin, s);
}

void solve(){
	for(int i = 0; i < s.length()-m; i++){
		int k = i;
		for(int j = i; j < i + m; j++)
			if (s[j] <= s[k]) k = j;
		ans = ans + s[k];
		a[k] = 1;
		mx = max(mx, s[k]);
		i = k;
	}

	for(int i = 0; i < s.length(); i++){
		if (s[i] < mx && !a[i]) ans = ans + mx;
	}

	sort(ans.begin(), ans.end());
	puts(ans.c_str());
}

int main(){
	clock_t timestart, timeend;
	timestart = clock();
//	freopen("input.inp","r",stdin);
//	freopen("output.out","w",stdout);
	input();
	solve();
	timeend = clock();
	//system("pause");
	//printf("\nRun time : %lf",(timeend-timestart)*1.0/CLK_TCK);
	return 0;
}


#include <iostream>
#include <cstdio>
#include <ctime>
#include <vector>
#include <algorithm>
#include <cmath>
#include <cstring>

#define rep(i,a,b) for(int i=(a),_b=(b);i<_b;i++)
#define repn(i,a,b) for(int i=(a),_b=(b);i<=_b;i++)
#define pern(i,b,a) for(int i=(b),_a=(a);i>=_a;i--)
#define fi first
#define se second
#define pb push_back
#define mp make_pair
#define sqr(i) 1ll*i*i
#define sz(x) int((x).size())

using namespace std;

typedef long long ll;
typedef unsigned long long ull;
typedef pair<int, int> pii;
typedef vector<int> vi;
typedef vector<pii> vii;

const int maxn = 100010;

int m;
string s;
int a[maxn];
char mx;
string ans;

void input(){
	scanf("%d\n",&m);
	getline(cin, s);
}

void solve(){
	for(int i = 0; i < s.length()-m; i++){
		int k = i;
		for(int j = i; j < i + m; j++)
			if (s[j] <= s[k]) k = j;
		ans = ans + s[k];
		a[k] = 1;
		mx = max(mx, s[k]);
		i = k;
	}

	for(int i = 0; i < s.length(); i++){
		if (s[i] < mx) ans = ans + mx;
	}

	sort(ans.begin(), ans.end());
	puts(ans.c_str());
}

int main(){
	clock_t timestart, timeend;
	timestart = clock();
//	freopen("input.inp","r",stdin);
//	freopen("output.out","w",stdout);
	input();
	solve();
	timeend = clock();
	//system("pause");
	//printf("\nRun time : %lf",(timeend-timestart)*1.0/CLK_TCK);
	return 0;
}


#include <bits/stdc++.h>

#define inf 0x3f3f3f3f

#define MOD 1000000007

#define pb push_back

#define sq(x) ((x)*(x))

#define x first

#define y second

#define eps 1e-8

#define bpt(x) (__builtin_popcount(x))

#define bptl(x) (__builtin_popcountll(x))

#define bit(x, y) (((x)>>(y))&1)

#define bclz(x) (__builtin_clz(x))

#define bclzl(x) (__builtin_clzll(x))

#define bctz(x) (__builtin_ctz(x))

#define bctzl(x) (__builtin_ctzll(x))

#define debug(x) cout << #x << " = " << x << endl

#define PQ priority_queue<pii, vector<pii>, greater<pii> >

using namespace std;

typedef long long INT;

typedef vector<int> VI;

typedef pair<int, int> pii;

typedef pair<pii, int> pi3;

typedef double DO;

template<typename T, typename U> inline void smin(T &a, U b) {if (a>b) a=b;}

template<typename T, typename U> inline void smax(T &a, U b) {if (a<b) a=b;}

#define NN 101010

char s[NN];

int vst[NN];

int main() {

//	freopen("in.in", "r", stdin);

	int m;

	scanf("%d%s", &m, s);

	int n=strlen(s);

	for (int j=0; j<26; j++) {

		int pre=-1, ok=0, flag=0;

		for (int i=0; i<n; i++) if (s[i]==j+'a') flag=1;

		for (int i=0; i<n; i++) {

			if (i-pre>m) {

				ok=1; break;

			}

			if (s[i]==j+'a') {

				if (i-pre>m) {

					ok=1; break;

				}

				pre=i;

			}

			if (vst[i]) pre=i;

		}

		if (!flag) continue;

		if (n-pre>m) ok=1;

		if (ok) {

			for (int i=0; i<n; i++) if (s[i]==j+'a') vst[i]=1;

		} else {

			pre=-1;

			int pp=-1;

			for (int i=0; i<n; i++) {

				if (i-pre>m) {

					vst[pp]=1;

					pre=pp;

				}

				if (s[i]==j+'a') pp=i;

				if (vst[i]) pre=i;

			}

			if (n-pre>m) vst[pp]=1;

			break;

		}

	}

	int nn=0;

	for (int i=0; i<n; i++) if (vst[i]) s[nn++]=s[i];

	sort(s, s+nn); s[nn]=0;

	puts(s);

	return 0;

}


#include <bits/stdc++.h>

#define inf 0x3f3f3f3f

#define MOD 1000000007

#define pb push_back

#define sq(x) ((x)*(x))

#define x first

#define y second

#define eps 1e-8

#define bpt(x) (__builtin_popcount(x))

#define bptl(x) (__builtin_popcountll(x))

#define bit(x, y) (((x)>>(y))&1)

#define bclz(x) (__builtin_clz(x))

#define bclzl(x) (__builtin_clzll(x))

#define bctz(x) (__builtin_ctz(x))

#define bctzl(x) (__builtin_ctzll(x))

#define debug(x) cout << #x << " = " << x << endl

#define PQ priority_queue<pii, vector<pii>, greater<pii> >

using namespace std;

typedef long long INT;

typedef vector<int> VI;

typedef pair<int, int> pii;

typedef pair<pii, int> pi3;

typedef double DO;

template<typename T, typename U> inline void smin(T &a, U b) {if (a>b) a=b;}

template<typename T, typename U> inline void smax(T &a, U b) {if (a<b) a=b;}

#define NN 101010

char s[NN];

int vst[NN];

int main() {

	int m;

	scanf("%d%s", &m, s);

	int n=strlen(s);

	for (int j=0; j<26; j++) {

		int pre=-1, ok=0;

		for (int i=0; i<n; i++) {

			if (s[i]==j+'a') {

				if (i-pre>m) {

					ok=1; break;

				}

				pre=i;

			}

			if (vst[i]) pre=i;

			if (i-pre>m) {

				ok=1; break;

			}

		}

		if (n-pre>m) ok=1;

		if (ok) {

			for (int i=0; i<n; i++) if (s[i]==j+'a') vst[i]=1;

		} else {

			pre=-1;

			int pp=-1;

			for (int i=0; i<n; i++) {

				if (i-pre>m) {

					vst[pp]=1;

					pre=pp;

				}

				if (s[i]==j+'a') pp=i;

				if (vst[i]) pre=i;

			}

			break;

		}

	}

	int nn=0;

	for (int i=0; i<n; i++) if (vst[i]) s[nn++]=s[i];

	sort(s, s+nn); s[nn]=0;

	puts(s);

	return 0;

}


#include <bits/stdc++.h>

#define inf 0x3f3f3f3f

#define MOD 1000000007

#define pb push_back

#define sq(x) ((x)*(x))

#define x first

#define y second

#define eps 1e-8

#define bpt(x) (__builtin_popcount(x))

#define bptl(x) (__builtin_popcountll(x))

#define bit(x, y) (((x)>>(y))&1)

#define bclz(x) (__builtin_clz(x))

#define bclzl(x) (__builtin_clzll(x))

#define bctz(x) (__builtin_ctz(x))

#define bctzl(x) (__builtin_ctzll(x))

#define debug(x) cout << #x << " = " << x << endl

using namespace std;

typedef long long INT;

typedef vector<int> VI;

typedef pair<int, int> pii;

typedef pair<pii, int> pi3;

typedef double DO;

template<typename T, typename U> inline void smin(T &a, U b) {if (a>b) a=b;}

template<typename T, typename U> inline void smax(T &a, U b) {if (a<b) a=b;}

#define NN 100100

char s[NN];

int cnt[26], pre[NN];

int main() {

	int n, m;

	cin >> m;

	scanf("%s", s);

	n=strlen(s);

	for(int i=0; i<n; i++) cnt[s[i]-'a']++;

	int i;

	for(i=0; i<26; i++){

		int p=-1, ok=1;

		for(int j=0; j<n; j++){

			if(s[j]<='a'+i) p=j;

			if(j-p>=m){

				ok=0;

				break;

			}

		}

		if(ok) break;

	}

	for(int j=0, last=-1; j<n; j++){

		if(s[j]=='a'+i) last=j;

		pre[j]=last;

	}

	int ct=0, p=-1;

	for(int j=0; j<n; j++){

		if(s[j]<'a'+i) p=j;

		if(j-p>=m){

			ct++;

			p=pre[j];

		}

	}

	for(int k=0; k<i; k++){

		while(cnt[k]--) putchar('a'+k);

	}

	while(ct--) putchar('a'+i);

	return 0;

}


#include <bits/stdc++.h>

#define inf 0x3f3f3f3f

#define MOD 1000000007

#define pb push_back

#define sq(x) ((x)*(x))

#define x first

#define y second

#define eps 1e-8

#define bpt(x) (__builtin_popcount(x))

#define bptl(x) (__builtin_popcountll(x))

#define bit(x, y) (((x)>>(y))&1)

#define bclz(x) (__builtin_clz(x))

#define bclzl(x) (__builtin_clzll(x))

#define bctz(x) (__builtin_ctz(x))

#define bctzl(x) (__builtin_ctzll(x))

#define debug(x) cout << #x << " = " << x << endl

#define PQ priority_queue<pii, vector<pii>, greater<pii> >

using namespace std;

typedef long long INT;

typedef vector<int> VI;

typedef pair<int, int> pii;

typedef pair<pii, int> pi3;

typedef double DO;

template<typename T, typename U> inline void smin(T &a, U b) {if (a>b) a=b;}

template<typename T, typename U> inline void smax(T &a, U b) {if (a<b) a=b;}

#define NN 101010

char s[NN];

int vst[NN];

int tmparr[NN];

int main() {

//	freopen("in.in", "r", stdin);

	int m;

	scanf("%d%s", &m, s);

	int n=strlen(s);

	for (int j=0; j<26; j++) {

		int pre=-1, ok=0, flag=0;

		for (int i=0; i<n; i++) {

			if (i-pre>m) {

				ok=1; break;

			}

			if (s[i]==j+'a') {

				flag=1;

				pre=i;

			}

			if (vst[i]) pre=i;

		}

		if (!flag) continue;

		if (n-pre>m) ok=1;

		if (ok) {

			for (int i=0; i<n; i++) if (s[i]==j+'a') vst[i]=1;

		} else {

			for(int i=0; i<n; i++) if(s[i]==j+'a') vst[i]=1;

			int kk=0;

			for(int i=0; i<n; i++)

				if(vst[i]) tmparr[kk++]=i;

			tmparr[kk]=n;

			int pp=-1;

			for(int i=0; i<kk; i++){

				int u=tmparr[i];

				int v=tmparr[i+1];

				if(s[u]!=j+'a'){

					pp=u;

					continue;

				}

				if(v-pp<=m) vst[u]=0;

				else pp=u;

			}

		}

	}

	int nn=0;

	for (int i=0; i<n; i++) if (vst[i]) s[nn++]=s[i];

	sort(s, s+nn); s[nn]=0;

	puts(s);

	return 0;

}


#include <bits/stdc++.h>

#define inf 0x3f3f3f3f

#define MOD 1000000007

#define pb push_back

#define sq(x) ((x)*(x))

#define x first

#define y second

#define eps 1e-8

#define bpt(x) (__builtin_popcount(x))

#define bptl(x) (__builtin_popcountll(x))

#define bit(x, y) (((x)>>(y))&1)

#define bclz(x) (__builtin_clz(x))

#define bclzl(x) (__builtin_clzll(x))

#define bctz(x) (__builtin_ctz(x))

#define bctzl(x) (__builtin_ctzll(x))

#define debug(x) cout << #x << " = " << x << endl

#define PQ priority_queue<pii, vector<pii>, greater<pii> >

using namespace std;

typedef long long INT;

typedef vector<int> VI;

typedef pair<int, int> pii;

typedef pair<pii, int> pi3;

typedef double DO;

template<typename T, typename U> inline void smin(T &a, U b) {if (a>b) a=b;}

template<typename T, typename U> inline void smax(T &a, U b) {if (a<b) a=b;}

#define NN 101010

char s[NN];

int vst[NN];

int main() {

	int m;

	scanf("%d%s", &m, s);

	int n=strlen(s);

	for (int j=0; j<26; j++) {

		int pre=-1, ok=0, flag=0;

		for (int i=0; i<n; i++) {

			if (s[i]==j+'a') {

				flag=1;

				if (i-pre>m) {

					ok=1; break;

				}

				pre=i;

			}

			if (vst[i]) pre=i;

			if (i-pre>m) {

				ok=1; break;

			}

		}

		if (!flag) continue;

		if (n-pre>m) ok=1;

		if (ok) {

			for (int i=0; i<n; i++) if (s[i]==j+'a') vst[i]=1;

		} else {

			pre=-1;

			int pp=-1;

			for (int i=0; i<n; i++) {

				if (i-pre>m) {

					vst[pp]=1;

					pre=pp;

				}

				if (s[i]==j+'a') pp=i;

				if (vst[i]) pre=i;

			}

			break;

		}

	}

	int nn=0;

	for (int i=0; i<n; i++) if (vst[i]) s[nn++]=s[i];

	sort(s, s+nn); s[nn]=0;

	puts(s);

	return 0;

}


#include <bits/stdc++.h>

#define inf 0x3f3f3f3f

#define MOD 1000000007

#define pb push_back

#define sq(x) ((x)*(x))

#define x first

#define y second

#define eps 1e-8

#define bpt(x) (__builtin_popcount(x))

#define bptl(x) (__builtin_popcountll(x))

#define bit(x, y) (((x)>>(y))&1)

#define bclz(x) (__builtin_clz(x))

#define bclzl(x) (__builtin_clzll(x))

#define bctz(x) (__builtin_ctz(x))

#define bctzl(x) (__builtin_ctzll(x))

#define debug(x) cout << #x << " = " << x << endl

#define PQ priority_queue<pii, vector<pii>, greater<pii> >

using namespace std;

typedef long long INT;

typedef vector<int> VI;

typedef pair<int, int> pii;

typedef pair<pii, int> pi3;

typedef double DO;

template<typename T, typename U> inline void smin(T &a, U b) {if (a>b) a=b;}

template<typename T, typename U> inline void smax(T &a, U b) {if (a<b) a=b;}

#define NN 101010

char s[NN];

int vst[NN];

int main() {

	int m;

	scanf("%d%s", &m, s);

	int n=strlen(s);

	for (int j=0; j<26; j++) {

		int pre=-1, ok=0, flag=0;

		for (int i=0; i<n; i++) {

			if (i-pre>m) {

				ok=1; break;

			}

			if (s[i]==j+'a') {

				flag=1;

				pre=i;

			}

			if (vst[i]) pre=i;

		}

		if (!flag) continue;

		if (n-pre>m) ok=1;

		if (ok) {

			for (int i=0; i<n; i++) if (s[i]==j+'a') vst[i]=1;

		} else {

			pre=-1;

			int pp=-1;

			for (int i=0; i<n; i++) {

				if (i-pre>m) {

					vst[pp]=1;

					pre=pp;

				}

				if (s[i]==j+'a') pp=i;

				if (vst[i]) pre=i;

			}

			if (n-pre>m) vst[pp]=1;

			break;

		}

	}

	int nn=0;

	for (int i=0; i<n; i++) if (vst[i]) s[nn++]=s[i];

	sort(s, s+nn); s[nn]=0;

	puts(s);

	return 0;

}


#include <bits/stdc++.h>

#define inf 0x3f3f3f3f

#define MOD 1000000007

#define pb push_back

#define sq(x) ((x)*(x))

#define x first

#define y second

#define eps 1e-8

#define bpt(x) (__builtin_popcount(x))

#define bptl(x) (__builtin_popcountll(x))

#define bit(x, y) (((x)>>(y))&1)

#define bclz(x) (__builtin_clz(x))

#define bclzl(x) (__builtin_clzll(x))

#define bctz(x) (__builtin_ctz(x))

#define bctzl(x) (__builtin_ctzll(x))

#define debug(x) cout << #x << " = " << x << endl

#define PQ priority_queue<pii, vector<pii>, greater<pii> >

using namespace std;

typedef long long INT;

typedef vector<int> VI;

typedef pair<int, int> pii;

typedef pair<pii, int> pi3;

typedef double DO;

template<typename T, typename U> inline void smin(T &a, U b) {if (a>b) a=b;}

template<typename T, typename U> inline void smax(T &a, U b) {if (a<b) a=b;}

#define NN 101010

char s[NN];

int vst[NN];

int main() {

	int m;

	scanf("%d%s", &m, s);

	int n=strlen(s);

	for (int j=0; j<26; j++) {

		int pre=-1, ok=0, flag=0;

		for (int i=0; i<n; i++) {

			if (s[i]==j+'a') {

				flag=1;

				if (i-pre>m) {

					ok=1; break;

				}

				pre=i;

			}

			if (vst[i]) pre=i;

			if (i-pre>m) {

				ok=1; break;

			}

		}

		if (!flag) continue;

		if (n-pre>m) ok=1;

		if (ok) {

			for (int i=0; i<n; i++) if (s[i]==j+'a') vst[i]=1;

		} else {

			pre=-1;

			int pp=-1;

			for (int i=0; i<n; i++) {

				if (i-pre>m) {

					vst[pp]=1;

					pre=pp;

				}

				if (s[i]==j+'a') pp=i;

				if (vst[i]) pre=i;

			}

			if (n-pre>m) vst[pp]=1;

			break;

		}

	}

	int nn=0;

	for (int i=0; i<n; i++) if (vst[i]) s[nn++]=s[i];

	sort(s, s+nn); s[nn]=0;

	puts(s);

	return 0;

}


/*
 * test.cpp
 *
 *  Created on: Sep 26, 2016
 *      Author: SCE15-0683
 */

#include<iostream>
#include<cstdio>
#include<vector>
#include<algorithm>
#include<queue>
#include<string>
#include<map>
#include<cmath>
#include<bitset>
#include<set>
#include<iomanip>
#include<fstream>
#include<bitset>
#include<cstring>
#include<cstdlib>
#include<complex>
#include<list>
#include<sstream>

using namespace std;

typedef pair<int,int> ii;
typedef pair<int,long long> il;
typedef pair<long long,long long> ll;
typedef pair<ll,int> lli;
typedef pair<long long,int> li;
typedef pair<int,ii> iii;
typedef pair<int,il> iil;
typedef pair<li,ii> liii;
long long mod = 1000000007LL;
long long base = 37;
long long large = 1000000000000000000LL;

int main(){
	int m;
	string s;
	cin>>m>>s;
	int n=(int)s.length();
	vector<int> a(n,0);
	for(int i=0;i<n;i++){
		a[i]=(int)(s[i]-'a');
	}
	int l = n-m+1;
	vector<bool> u(l,false);
	int c;
	int cnt = 0;
	for(c=0;c<26;c++){
		cnt=0;
		vector<int> re;
		for(int i=0;i<l;i++){
			if(!u[i]) re.push_back(i);
		}
		bool can = true;
		vector<int> seg;
		for(int i=0;i<n;i++){
			if(a[i]==c) seg.push_back(i-m+1);
		}
		int rb= -1000000000;
		int p=0;
		for(int i=0;i<(int)re.size();i++){
			if(re[i]<=rb) continue;
			while(p+1<(int)seg.size()&&seg[p+1]<=re[i]) p++;
			rb=seg[p]+m-1;
			if(rb<re[i]){
				can=false;
				break;
			}else{
				cnt++;
			}
		}
		if(can){
			break;
		}else{
			seg.clear();
			for(int i=0;i<n;i++){
				if(a[i]==c) seg.push_back(i-m+1);
			}
			int rb = -1000000000;
			int p = 0;
			for(int i=0;i<l;i++){
				if(i<=rb) u[i]=true;
				while(p+1<(int)seg.size()&&seg[p+1]<=i)p++;
				rb=seg[p]+m-1;
				if(i<=rb) u[i]=true;
			}
		}
	}

	vector<int> cn(30,0);
	for(int i=0;i<n;i++) cn[a[i]]++;
	for(int i=0;i<c;i++) while(cn[i]--) cout<<(char)(i+'a');
	while(cnt--) cout<<(char)('a'+c);
	cout<<endl;
	return 0;

}