Code
#include<bits/stdc++.h>
using namespace std;
#define ll long long int
int main()
{
ll tc;
cin>>tc;
while(tc--)
{
ll n,k;
cin>>n>>k;
string s;
cin>>s;
string p,l;
p=s;
sort(p.begin(),p.end());
reverse(p.begin(),p.end());
map<char,ll>mp;
for(int i=0;i<n-k;i++)
l+=p[i];
if(l.size()==0) cout<<0<<endl;
else
cout<<l<<endl;
}
}
Information
- Submit By
- Type
- Submission
- Problem
- P1006 Remove K Digits
- Language
- C++17 (G++ 13.2.0)
- Submit At
- 2024-11-05 18:38:54
- Judged At
- 2024-11-05 18:38:54
- Judged By
- Score
- 0
- Total Time
- 2ms
- Peak Memory
- 540.0 KiB