Untitled

Anonymous
plain_text
10/14/2026 9:15 PM
576 B
3
Indexable
#include<iostream>
#include<string>
using namespace std;



int main() 
{
	int n, k;
	cin >> n >> k;
	string s;
	cin >> s;
	for (char i = 'a'; i <= 'z'; i++)
	{
		for (int z = 0; z < s.size(); )
		{
			if (s[z] == i)
			{
				s.erase(z, 1);
				k--;

			}
			else
			{
				z++;
			}
			if (k == 0)
			{
				break;
			}


		}
		if (k == 0)
		{
			break;
		}
	}
	
	cout << s;

	return 0;
}
Editor is loading...
Leave a Comment