#include #include #include #include #include #include #include #include using namespace std; string zad1(int N, int K, string text) { int i = N - 2; sort(text.begin(), text.end()); while (i >= 0 && text.length() > K) { if (text[i] == text[i + 1]) { text = text.substr(0, i) + text.substr(i + 1, text.length()); } i--; } return text; } int main() { int N, K; string text; fstream myFile; myFile.open("letters.in"); myFile >> N >> K; myFile.close(); myFile.open("letters.out"); myFile << zad1(N, K, text); myFile.close(); return 0; }