#include <bits/stdc++.h>   using namespace std;   int main() {     ios_base::sync_with_stdio(false), cin.tie(nullptr), cout.tie(nullptr);     ;     string a;     int n;     cin >> a >> n;     for (int i = 0; i < a.length() && n; ++i) {       char x = a[i];       int y = i;       for (int j = i + 1; j <= min((int)a.length() - 1, i + n) && n; ++j)         if (x < a[j]) x = a[j], y = j;       if (y != i) {         n -= y - i;         while (i != y) {           swap(a[y - 1], a[y]);           y--;         }       }     }     cout << a << endl;     return 0;   }   